Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- rip
- CKA
- ACL
- crontab
- Redistribute
- 장비
- 명령어
- 헤더
- ripng
- Etherchannel
- Inter VLAN
- OSI 7 layer
- tunneling
- 라우터
- DHCP
- eigrp
- stp
- NAT
- GLBP
- OSPF
- 스위치
- Chrony
- eigrpv2
- ipv6
- Vlan
- vrrp
- ospfv3
Archives
- Today
- Total
Net Eng
[CKA] - CPU 사용량이 높은 파드 검색 본문
[선수 지식]
pod, node -> cpu, mem
kubectl top nodes
kubectl top pods
[선수 작업]
kubectl config set-context k8s --user=kubernetes-admin --cluster=cluster.local
mkdir -p /var/CKA2023
kubectl apply -f - <<EOF
kind: Pod
apiVersion: v1
metadata:
name: campus-01
labels:
name: overloaded-cpu
spec:
containers:
- name: campus-container
image: busybox
command:
- "/bin/sh"
- "-c"
- >
a=1;
while true;
do
a=$(expr a + 1);
done;
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "1"
EOF
kubectl apply -f - <<EOF
kind: Pod
apiVersion: v1
metadata:
name: fast-01
labels:
name: overloaded-cpu
spec:
containers:
- name: fast-container
image: busybox
command:
- "/bin/sh"
- "-c"
- >
a=1;
while true;
do
a=$(expr a + 1);
sleep 0.001
done;
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "1"
EOF
echo "[ OK ] Please wait a minute."
sleep 20
[문제]
From the pod label name=overloaded-cpu, find pods running high CPU workloads and write the name of the pod consuming most CPU to the file /var/CKA2023/cpu_load_pod.txt.
작업 클러스터: hk8s
[풀이]
kubectl config use-context hk8s
* hk8s 클러스터 사용
kubectl top pods -l name=overloaded-cpu --sort-by=cpu
* top 명령어로 cpu 사용량이 높은 순으로 Pod 정렬
echo "POD_NAME" > /var/CKA2023/cpu_load_pod.txt
* 파일로 해당 Pod 이름 저장
[참고]
Kubectl Reference Docs
kubernetes.io
'Cloud > Kubernetes' 카테고리의 다른 글
[CKA] - NodePort 서비스 생성 (1) | 2024.01.22 |
---|---|
[CKA] - Init Container를 포함한 Pod 운영 (1) | 2024.01.22 |
[CKA] - Pod Log 추출 (0) | 2024.01.21 |
[CKA] - Deployment & Expose the Service (0) | 2024.01.21 |
[CKA] - Node 정보 수집 (0) | 2024.01.21 |