Skip to Content
Kubernetes 认证管理员 (CKA) 学习指南 (Chinese Edition), 2nd Edition
book

Kubernetes 认证管理员 (CKA) 学习指南 (Chinese Edition), 2nd Edition

by Benjamin Muschko
January 2026
Intermediate to advanced
392 pages
4h 44m
Chinese
O'Reilly Media, Inc.
Content preview from Kubernetes 认证管理员 (CKA) 学习指南 (Chinese Edition), 2nd Edition

第22章 故障排除 集群

本作品已使用人工智能进行翻译。欢迎您提供反馈和意见:translation-feedback@oreilly.com

当Kubernetes集群 遭遇基础设施级故障时,其影响可能灾难性。Pod拒绝调度、应用程序无法访问、整节点从集群消失,可能同时影响数百个工作负载。与仅影响单一服务的应用程序特定问题不同,集群组件和节点的问题直击Kubernetes环境根基,因此快速诊断与解决对维持系统可用性至关重要。

本章将传授您排查此类基础设施级问题的技能。您将学会解读节点状态、探究节点转入NotReady状态的原因、解决资源压力状况,并追溯Pod调度失败的根本原因。

检查集群节点状态

诸多因素可能导致Kubernetes集群在组件层面出现 故障。建议列出集群中可用节点以识别潜在问题:

$ kubectl get nodes
NAME                 STATUS   ROLES           AGE     VERSION
control-plane-node   Ready    control-plane   2m45s   v1.33.2
worker-node-1        Ready    <none>          2m36s   v1.33.2
worker-node-2        Ready    <none>          2m29s   v1.33.2
worker-node-3        Ready    <none>          2m22s   v1.33.2

输出结果将呈现整体概况。通过ROLES列可轻松识别各节点职责,同时掌握其使用的 Kubernetes 版本及当前健康状态。

在高层次排查问题时需关注以下要点:

  • 该节点的健康状态是否为非就绪状态?

  • 节点版本是否与其他节点存在差异?

后续章节将分别详述控制平面节点与工作节点的故障排查方法。

检查集群组件状态

在 中,控制平面节点上可用的组件包括:

kube-apiserver

暴露用于管理对象的Kubernetes API( ),供kubectl等客户端使用

etcd

用于存储集群数据的键值存储库

kube-调度器

为已调度但未创建的Pod选择节点( )

核心DNS

充当集群的DNS服务器 ,自动创建DNS记录使Pod和Service能通过名称而非IP地址相互发现,同时处理工作负载的外部DNS解析

kube-controller-manager

运行控制器进程 (例如负责执行Job对象的作业控制器)

云控制器管理器(可选)

将Cloud服务商专属API( )与Kubernetes集群对接。此控制器不适用于本地部署的Kubernetes集群

除控制平面节点专属组件外,所有节点(控制平面与工作节点)均可能包含以下组件:

kubelet

确保所有Pod( )及其容器正常运行

kube-proxy(可选)

维护节点上的网络规则 以实现服务

容器运行时

负责运行容器的软件组件

要发现这些组件及其状态,请列出kube-system命名空间中的可用Pod。请注意某些组件不以Pod形式运行,例如kubelet或容器运行时。组件列表如下:

$ kubectl get pods -n kube-system NAME READY STATUS RESTARTS AGE etcd 1/1 Running 1 (11d ago) 29d kube-apiserver 1/1 Running 1 (11d ago) 29d kube-controller-manager 1/1 Running ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Kubernetes 上的生成式人工智能 (Chinese Edition)

Kubernetes 上的生成式人工智能 (Chinese Edition)

Roland Huß, Daniele Zonca
游戏化头脑风暴

游戏化头脑风暴

Dave Gray, Sunni Brown, James Macanufo

Publisher Resources

ISBN: 0642572314712