Skip to content

Commit d69f80a

Browse files
authored
Merge pull request #50266 from my-git9/np-26897
[zh-cn]sync self-healing.md
2 parents 992e35c + 2591606 commit d69f80a

File tree

1 file changed

+101
-0
lines changed

1 file changed

+101
-0
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
title: Kubernetes 自我修复
3+
content_type: concept
4+
Weight: 50
5+
---
6+
<!--
7+
title: Kubernetes Self-Healing
8+
content_type: concept
9+
Weight: 50
10+
-->
11+
12+
<!-- overview -->
13+
14+
<!--
15+
Kubernetes is designed with self-healing capabilities that help maintain the health and availability of workloads.
16+
It automatically replaces failed containers, reschedules workloads when nodes become unavailable, and ensures that the desired state of the system is maintained.
17+
-->
18+
Kubernetes 旨在通过自我修复能力来维护工作负载的健康和可用性。
19+
它能够自动替换失败的容器,在节点不可用时重新调度工作负载,
20+
并确保系统的期望状态得以维持。
21+
22+
<!-- body -->
23+
24+
<!--
25+
## Self-Healing capabilities {#self-healing-capabilities}
26+
27+
- **Container-level restarts:** If a container inside a Pod fails, Kubernetes restarts it based on the [`restartPolicy`](/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy).
28+
29+
- **Replica replacement:** If a Pod in a [Deployment](/docs/concepts/workloads/controllers/deployment/) or [StatefulSet](/docs/concepts/workloads/controllers/statefulset/) fails, Kubernetes creates a replacement Pod to maintain the specified number of replicas.
30+
If a Pod fails that is part of a [DaemonSet](/docs/concepts/workloads/controllers/daemonset/) fails, the control plane
31+
creates a replacement Pod to run on the same node.
32+
-->
33+
## 自我修复能力 {#self-healing-capabilities}
34+
35+
- **容器级重启:** 如果 Pod 中的某个容器失败,Kubernetes 会根据
36+
[`restartPolicy`](/zh-cn/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy)
37+
定义的策略重启此容器。
38+
39+
- **副本替换:** 如果 [Deployment](/zh-cn/docs/concepts/workloads/controllers/deployment/)
40+
[StatefulSet](/zh-cn/docs/concepts/workloads/controllers/statefulset/) 中的某个 Pod 失败,
41+
Kubernetes 会创建一个替代 Pod,以维持指定的副本数量。
42+
如果属于 [DaemonSet](/zh-cn/docs/concepts/workloads/controllers/daemonset/)
43+
的某个 Pod 失败,控制平面会在同一节点上创建一个替代 Pod。
44+
45+
<!--
46+
- **Persistent storage recovery:** If a node is running a Pod with a PersistentVolume (PV) attached, and the node fails, Kubernetes can reattach the volume to a new Pod on a different node.
47+
48+
- **Load balancing for Services:** If a Pod behind a [Service](/docs/concepts/services-networking/service/) fails, Kubernetes automatically removes it from the Service's endpoints to route traffic only to healthy Pods.
49+
-->
50+
- **持久存储恢复:** 如果某个节点正在运行一个挂载了持久卷(PV)
51+
的 Pod,且该节点发生故障,Kubernetes 可以将该卷重新挂载到另一个节点上的新 Pod。
52+
53+
- **服务的负载均衡:** 如果 [Service](/zh-cn/docs/concepts/services-networking/service/)
54+
背后的某个 Pod 失败,Kubernetes 会自动将其从 Service 的端点中移除,
55+
以确保流量仅路由到健康的 Pod。
56+
57+
<!--
58+
Here are some of the key components that provide Kubernetes self-healing:
59+
60+
- **[kubelet](/docs/concepts/architecture/#kubelet):** Ensures that containers are running, and restarts those that fail.
61+
62+
- **ReplicaSet, StatefulSet and DaemonSet controller:** Maintains the desired number of Pod replicas.
63+
64+
- **PersistentVolume controller:** Manages volume attachment and detachment for stateful workloads.
65+
-->
66+
以下是提供 Kubernetes 自我修复功能的一些关键组件:
67+
68+
- **[kubelet](/zh-cn/docs/concepts/architecture/#kubelet)**
69+
确保容器正在运行,并重启失败的容器。
70+
71+
- **ReplicaSet、StatefulSet 和 DaemonSet 控制器:** 维持期望的 Pod 副本数量。
72+
73+
- **PersistentVolume 控制器:** 管理有状态工作负载的卷挂载和卸载。
74+
75+
<!--
76+
## Considerations {#considerations}
77+
78+
- **Storage Failures:** If a persistent volume becomes unavailable, recovery steps may be required.
79+
80+
- **Application Errors:** Kubernetes can restart containers, but underlying application issues must be addressed separately.
81+
-->
82+
## 注意事项 {#considerations}
83+
84+
- **存储故障:** 如果持久卷变得不可用,可能需要执行恢复步骤。
85+
86+
- **应用程序错误:** Kubernetes 可以重启容器,但底层的应用程序问题需要单独解决。
87+
88+
## {{% heading "whatsnext" %}}
89+
90+
<!--
91+
- Read more about [Pods](/docs/concepts/workloads/pods/)
92+
- Learn about [Kubernetes Controllers](/docs/concepts/architecture/controller/)
93+
- Explore [PersistentVolumes](/docs/concepts/storage/persistent-volumes/)
94+
- Read about [node autoscaling](/docs/concepts/cluster-administration/node-autoscaling/). Node autoscaling
95+
also provides automatic healing if or when nodes fail in your cluster.
96+
-->
97+
- 进一步阅读 [Pod](/zh-cn/docs/concepts/workloads/pods/)
98+
- 了解 [Kubernetes 控制器](/zh-cn/docs/concepts/architecture/controller/)
99+
- 探索 [持久卷(PersistentVolume)](/zh-cn/docs/concepts/storage/persistent-volumes/)
100+
- 阅读关于[节点自动扩展](/zh-cn/docs/concepts/cluster-administration/node-autoscaling/)
101+
节点自动扩展还能够在集群中的节点发生故障时提供自动修复功能。

0 commit comments

Comments
 (0)