相关命令
get
kubectl get pods --show-labels
lifecycle
Pending
scheduled 和 pull image
Running
pod 已经bound to node, 至少有有一个container可以工作
Succeeded
所有的容器已经成功zhong终止,不会restart
Failed
大部分container已经终止, 至少超过一个container 终止失败
Unknown
失去与pod的联系,可能与node失去连接
pod restart reason
https://kubernetes.io/docs/user-guide/pods/init-container/#pod-restart-reasons
- app init container image is changed
- The pod infrastructure container is restarted
- All containers in a pod are terminated, requiring a restart (RestartPolicyAlways) AND the record of init container completion has been lost due to garbage collection.
Probe
- Probe 自定义执行监控检查,来决定pod是否还存活,是否准备好接受服务请求
- 任何处于runing 的容器,都执行LivenessProbe和ReadinessProbe检测。 具体参考 http://kubernetes.io/docs/user-guide/pod-states/#container-probes 提供pod细节运行的状态
LivenessProbe
基本健康监测,如果检测到Fail, 则根据restartPolicy 执行相应操作,默认初始化的状态是success
ReadinessProbe
准备就绪检测,如果检测到Fail,endpoints controller 从service移除该pod的ip,初始化状态是Fail
debuging
查看前一个容器退出的状态信息
get pod --namespace=kube-system kube-dns-2565572517-3nk30 -o yaml | grep -C5 lastState










网友评论