kubernetes - 更详细的 Pod 状态监控
问题描述
我们的 Pod 通常会在状态中花费至少一分钟到数分钟Pending
,这些事件通过kubectl describe pod x
yield:
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 运行的确切情况和确切时间,以便解决哪个步骤确切需要多少时间?
特别感兴趣的是安装卷需要多长时间的指标。
解决方案
检查 kubelet 和 kube 调度程序日志,因为 kube 调度程序将 pod 调度到一个节点,并且 kubelet 在该节点上启动 pod 并报告状态为就绪。
journalctl -u kubelet # after logging into the kubernetes node
kubectl logs kube-scheduler -n kube-system
描述 pod、deployment、replicaset 以获取更多详细信息
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
推荐阅读
- java - if 语句可以简化吗?
- python - How to log for each script using logging (python)
- flutter - 防止容器填充 ReorderableListView 中的所有空间
- java - Androidx ViewPager2 不兼容类型:ViewPagerAdapter 无法转换为 Adapter
- amazon-web-services - 我将如何创建一个 Minecraft EC2 服务器,当有人尝试使用它时它会自动启动
- sql-server - Docker 无法访问外部数据库服务器
- ruby-on-rails - 是否需要在 form_with 中提供范围、url 和模型?
- python - 如何在python中表示函数参数
- assembly - 如何在 ARM 程序集中检测无效的用户输入
- javascript - 具有函数的对象中的流类型