Use context: kubectl config use-context k8s-c1-H

Check all available Pods in the Namespace project-c13 and find the names of those that would probably be terminated first if the nodes run out of resources (cpu or memory) to schedule all Pods. Write the Pod names into /opt/course/e1/pods-not-stable.txt.


译文:

检查名称空间 project-c13 中所有可用的Pod,找到那些在节点资源(cpu或内存)耗尽的情况下可能会首先终止的Pod的名称,以安排所有Pod。把Pod的名字写进 /opt/course/e1/pods-not-stable.txt


解答:

当节点上的可用cpu或内存资源达到极限时,Kubernetes将寻找那些使用的资源超过其要求的Pod。这些将是第一批终止的候选者。如果一些Pods容器没有设置资源请求/限制,那么默认情况下,这些容器将被视为使用超过请求。 参考https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod

kubectl config use-context k8s-c1-H

检查没有设置资源限制的pod

k -n project-c13 describe pod | egrep "^(Name:|    Requests:)" -A1

后面没有限制的pod有下面这些,写入到文件/opt/course/e1/pods-not-stable.txt即可

# /opt/course/e1/pods-not-stable.txt
c13-3cc-runner-heavy-65588d7d6-djtv9map
c13-3cc-runner-heavy-65588d7d6-v8kf5map
c13-3cc-runner-heavy-65588d7d6-wwpb4map
o3db-0
o3db-1 # maybe not existing if already removed via previous scenario

Killer.sh CKA模拟题目 汇总