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-Hg

检查没有设置资源限制的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