Resource Limits
1. A pod called rabbit is deployed. Identify the CPU requirements set on the Pod
in the current(default) namespace
controlplane ~ ➜ k describe pods rabbit
...
OCI runtime create failed: runc create failed: unable to start container process: error during container init: error setting cgroup config for procHooks process: failed to write "200000": write /sys/fs/cgroup/cpu,cpuacct/kubepods/burstable/pod70bf87fa-d206-4794-ac63-611921b4b364/e474d133cbcd3ab8cb47045a96478a452a1cf6b8db0e57b2eb18b1776cff31f2/cpu.cfs_quota_us: invalid argument: unknown
Exit Code: 128
Started: Thu, 01 Jan 1970 00:00:00 +0000
Finished: Sat, 22 Jun 2024 10:51:25 +0000
Ready: False
Restart Count: 4
Limits:
cpu: 2
Requests:
cpu: 1
Environment: <none>
Mounts:
...
answer : 1
2. Delete the rabbit Pod.
Once deleted, wait for the pod to fully terminate.
controlplane ~ ➜ k delete pod rabbit
pod "rabbit" deleted
3. Another pod called elephant has been deployed in the default namespace. It fails to get to a running state. Inspect this pod and identify the Reason why it is not running.
controlplane ~ ➜ k describe pod elephant
...
State: Terminated
Reason: OOMKilled
Exit Code: 1
Started: Sat, 22 Jun 2024 10:56:15 +0000
Finished: Sat, 22 Jun 2024 10:56:15 +0000
Last State: Terminated
Reason: OOMKilled
Exit Code: 1
Started: Sat, 22 Jun 2024 10:56:00 +0000
Finished: Sat, 22 Jun 2024 10:56:00 +0000
Ready: False
Restart Count: 2
Limits:
memory: 10Mi
...
pod describe 을 통해 pod 기동상태 확인시 OOMKilled 가 확인되어 실행이 안된것으로 확인됨.
anwser : OOMKilled
4. The status OOMKilled indicates that it is failing because the pod ran out of memory. Identify the memory limit set on the POD.
5. The elephant pod runs a process that consumes 15Mi of memory. Increase the limit of the elephant pod to 20Mi.
Delete and recreate the pod if required. Do not modify anything other than the required fields.
controlplane ~ ➜ k get pods elephant -o yaml > elephant.yaml
elephant.yaml
###
apiVersion: v1
kind: Pod
metadata:
name: elephant
namespace: default
spec:
containers:
- args:
- --vm
- "1"
- --vm-bytes
- 15M
- --vm-hang
- "1"
command:
- stress
image: polinux/stress
imagePullPolicy: Always
name: mem-stress
resources:
limits:
memory: 20Mi ## > limits 값 수정
requests:
memory: 5Mi
###
controlplane ~ ➜ k delete po elephant
pod "elephant" deleted
controlplane ~ ➜ k apply -f elephant.yaml
pod/elephant created
6. pod 실행 확인해보기..
7. Delete the elephant Pod.
Once deleted, wait for the pod to fully terminate.
controlplane ~ ➜ k delete pod elephant
pod "elephant" deleted
'IT 기술 > k8s' 카테고리의 다른 글
[cka] Monitor Cluster Components (0) | 2024.06.24 |
---|---|
[cka] Multiple Schedulers (0) | 2024.06.23 |
[cka] Node Affinity (0) | 2024.06.08 |
[cka] Taints and Tolerations (0) | 2024.06.08 |
[cka] Labels and Selectors (0) | 2024.06.08 |
댓글