kubectl get pod memory-demo-2 --namespace=mem-example
输出显示容器被终止、重新启动、再次终止、再次重新启动,依此类推:
kubectl get pod memory-demo-2 --namespace=mem-exampleNAME READY STATUS RESTARTS AGEmemory-demo-20/1 OOMKilled 1 37s
kubectl get pod memory-demo-2 --namespace=mem-exampleNAME READY STATUS RESTARTS AGEmemory-demo-21/1 Running 2 40s
查看有关POD历史记录的详细信息:
kubectl describe pod memory-demo-2 --namespace=mem-example
输出显示容器重复启动和失败:
... Normal Created Created container with id 66a3a20aa7980e61be4922780bf9d24d1a1d8b7395c09861225b0eba1b1f8511... Warning BackOff Back-off restarting failed container
查看有关群集节点的详细信息:
kubectl describe nodes
输出包括由于内存不足而被终止的容器的记录:
Warning OOMKilling Memory cgroup out of memory: Kill process 4481 (stress) score 1994 or sacrifice child
删除Pod:
kubectl delete pod memory-demo-2 --namespace=mem-example
kubectl get pod memory-demo-3 --namespace=mem-example
输出显示POD状态为挂起。也就是说,pod不计划在任何节点上运行,它将无限期地保持在挂起状态:
kubectl get pod memory-demo-3 --namespace=mem-exampleNAME READY STATUS RESTARTS AGEmemory-demo-30/1 Pending 0 25s
查看有关POD的详细信息,包括事件:
kubectl describe pod memory-demo-3 --namespace=mem-example
输出显示,由于节点上的内存不足,无法计划容器:
Events: ... Reason Message ------ ------- ... FailedScheduling No nodes are available that match all of the following predicates:: Insufficient memory (3).