Home 쿠버네티스 - exr9 - RESOURCE LIMITS
Post
Cancel

쿠버네티스 - exr9 - RESOURCE LIMITS

kubernetes exr9 RESOURCE LIMITS

1
2
3
4
5
6
7
8
9
# A pod called rabbit is deployed. Identify the CPU requirements set on the Pod
# in the current(default) namespace

k describe pod rabbit

Limits:
  cpu:  2
Requests:
  cpu:  1 # 1만큼 요청
1
2
3
4
# Delete the rabbit Pod.
# Once deleted, wait for the pod to fully terminate.

k delete pod rabbit
1
2
3
4
5
6
7
8
9
10
11
12
# 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.

k describe pod elephant

...
  State:        Waiting
    Reason:     CrashLoopBackOff
  Last State:   Terminated
    Reason:     OOMKilled # 이유에 해당
...

The status OOMKilled indicates that it is failing because the pod ran out of memory. Identify the memory limit set on the POD.
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
29
30
31
# The elephant pod runs a process that consume 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.

# k get po elephant -o 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
    name: mem-stress
    resources:
      limits:
        memory: 20Mi
      requests:
        memory: 5Mi

k replace -f elephant.yaml --force
This post is licensed under CC BY 4.0 by the author.