帮助改进此页面
要帮助改进本用户指南,请选择位于每个页面右侧窗格中的在 GitHub 上编辑此页面链接。
本主题介绍可用于监控 Amazon EKS 集群中节点运行状况检查状态的工具和方法。这些信息涵盖有助您识别和诊断节点级别问题的节点状况、事件和检测案例。使用本文描述的命令和模式来检查节点运行状况资源、解释状态条件,以及分析节点事件以进行运行故障排除。
您可以对所有节点使用 Kubernetes 命令来获取节点的某些运行状况信息。如果您通过 Amazon EKS 自动模式或 Amazon EKS 托管式附加组件使用节点监控代理,则将可获得更多种类的节点信号来帮助进行故障排除。对于节点监控代理检测到的运行状况问题,相关描述也可以在可观测性控制面板中查看。有关更多信息,请参阅 启用节点自动修复并调查节点运行状况问题。
节点状况
节点状况表示需要采取补救措施(例如更换实例或重启实例)的终端问题。
获取所有节点的状况:
kubectl get nodes -o 'custom-columns=NAME:.metadata.name,CONDITIONS:.status.conditions[*].type,STATUS:.status.conditions[*].status'
获取特定节点的详细状况
kubectl describe node
node-name
正常节点的状况输出示例:
- lastHeartbeatTime: "2024-11-21T19:07:40Z"
lastTransitionTime: "2024-11-08T03:57:40Z"
message: Monitoring for the Networking system is active
reason: NetworkingIsReady
status: "True"
type: NetworkingReady
出现网络问题的不正常节点的状况示例:
- lastHeartbeatTime: "2024-11-21T19:12:29Z"
lastTransitionTime: "2024-11-08T17:04:17Z"
message: IPAM-D has failed to connect to API Server which could be an issue with
IPTable rules or any other network configuration.
reason: IPAMDNotReady
status: "False"
type: NetworkingReady
节点事件
节点事件指示暂时性问题或配置不佳问题。
获取节点监控代理报告的所有事件
当节点监控代理可用时,您可以运行以下命令。
kubectl get events --field-selector=reportingComponent=eks-node-monitoring-agent
示例输出:
LAST SEEN TYPE REASON OBJECT MESSAGE
4s Warning SoftLockup node/ip-192-168-71-251.us-west-2.compute.internal CPU stuck for 23s
获取所有节点的事件
kubectl get events --field-selector involvedObject.kind=Node
获取特定节点的事件
kubectl get events --field-selector involvedObject.kind=Node,involvedObject.name=
node-name
实时观察事件
kubectl get events -w --field-selector involvedObject.kind=Node
事件输出示例:
LAST SEEN TYPE REASON OBJECT MESSAGE 2m Warning MemoryPressure Node/node-1 Node experiencing memory pressure 5m Normal NodeReady Node/node-1 Node became ready
常用故障排除命令
# Get comprehensive node status
kubectl get node node-name
-o yaml
# Watch node status changes
kubectl get nodes -w
# Get node metrics
kubectl top node