我们的Pod通常在Pending
状态下花费至少一分钟,最多几分钟,通过kubectl describe pod x
产生的事件产生:
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled <unknown> default-scheduler Successfully assigned testing/runner-2zyekyp-project-47-concurrent-0tqwl4 to host
Normal Pulled 55s kubelet, host Container image "registry.com/image:c1d98da0c17f9b1d4ca81713c138ee2e" already present on machine
Normal Created 55s kubelet, host Created container build
Normal Started 54s kubelet, host Started container build
Normal Pulled 54s kubelet, host Container image "gitlab/gitlab-runner-helper:x86_64-6214287e" already present on machine
Normal Created 54s kubelet, host Created container helper
Normal Started 54s kubelet, host Started container helper
所提供的信息并不能完全准确地找出正在发生的事情。
问题:
我们如何收集有关Pod运行的确切信息以及何时准确发生什么的更详细的指标,以排查哪一步恰好需要多少时间?
特别需要关注的是挂载卷需要多长时间。
答案 0 :(得分:1)
检查kubelet和kube调度程序日志,因为kube调度程序将pod调度到一个节点,而kubelet在该节点上启动pod并报告状态为就绪。
journalctl -u kubelet # after logging into the kubernetes node
kubectl logs kube-scheduler -n kube-system
描述pod,部署,副本集以获取更多详细信息
kubectl describe pod podnanme -n namespacename
kubectl describe deploy deploymentnanme -n namespacename
kubectl describe rs replicasetnanme -n namespacename
检查事件
kubectl get events -n namespacename
描述节点并检查可用资源和应准备好的状态。
kubectl describe node nodename