1
1
---
2
2
title : 运行于多可用区环境
3
- weight : 10
3
+ weight : 20
4
4
content_type : concept
5
5
---
6
6
<!--
@@ -9,7 +9,7 @@ reviewers:
9
9
- justinsb
10
10
- quinton-hoole
11
11
title: Running in multiple zones
12
- weight: 10
12
+ weight: 20
13
13
content_type: concept
14
14
-->
15
15
@@ -18,7 +18,7 @@ content_type: concept
18
18
<!--
19
19
This page describes running a cluster across multiple zones.
20
20
-->
21
- 本页描述如何跨多个区(Zone)中运行集群 。
21
+ 本页描述如何跨多个区(Zone)运行集群 。
22
22
23
23
<!-- body -->
24
24
@@ -35,11 +35,11 @@ APIs and services.
35
35
Typical cloud architectures aim to minimize the chance that a failure in
36
36
one zone also impairs services in another zone.
37
37
-->
38
- ## 背景
38
+ ## 背景 {#background}
39
39
40
40
Kubernetes 从设计上允许同一个 Kubernetes 集群跨多个失效区来运行,
41
- 通常这些区位于某个称作 _ 区域(region) _ 逻辑分组中。
42
- 主要的云提供商都将区域定义为一组失效区的集合(也称作 _ 可用区 (Availability Zones) _ ),
41
+ 通常这些区位于某个称作 ** 区域(Region) ** 逻辑分组中。
42
+ 主要的云提供商都将区域定义为一组失效区的集合(也称作 ** 可用区 (Availability Zones** ) ),
43
43
能够提供一组一致的功能特性:每个区域内,各个可用区提供相同的 API 和服务。
44
44
45
45
典型的云体系结构都会尝试降低某个区中的失效影响到其他区中服务的概率。
@@ -66,10 +66,10 @@ If you are running a cloud controller manager then you should
66
66
also replicate this across all the failure zones you selected.
67
67
-->
68
68
当你部署集群控制面时,应将控制面组件的副本跨多个失效区来部署。
69
- 如果可用性是一个很重要的指标,应该选择至少三个失效区,并将每个
70
- 控制面组件 (API 服务器、调度器、etcd、控制器管理器)复制多个副本,
71
- 跨至少三个失效区来部署。如果你在运行云控制器管理器,则也应该将
72
- 该组件跨所选的三个失效区来部署 。
69
+ 如果可用性是一个很重要的指标,应该选择至少三个失效区,
70
+ 并将每个控制面组件 (API 服务器、调度器、etcd、控制器管理器)复制多个副本,
71
+ 跨至少三个失效区来部署。如果你在运行云控制器管理器,
72
+ 则也应该将该组件跨所选的三个失效区来部署 。
73
73
74
74
{{< note >}}
75
75
<!--
@@ -94,9 +94,9 @@ reduce the impact of failures.
94
94
-->
95
95
## 节点行为 {#node-behavior}
96
96
97
- Kubernetes 自动为负载资源(如{{< glossary_tooltip text="Deployment" term_id="deployment" >}}
98
- 或 {{< glossary_tooltip text="StatefulSet" term_id="statefulset" >}}) )
99
- 跨集群中不同节点来部署其 Pods 。
97
+ Kubernetes 自动为负载资源(如 {{< glossary_tooltip text="Deployment" term_id="deployment" >}}
98
+ 或 {{< glossary_tooltip text="StatefulSet" term_id="statefulset" >}})
99
+ 跨集群中不同节点来部署其 Pod 。
100
100
这种分布逻辑有助于降低失效带来的影响。
101
101
102
102
<!--
@@ -106,8 +106,8 @@ that represents that specific kubelet in the Kubernetes API.
106
106
These labels can include
107
107
[zone information](/docs/reference/labels-annotations-taints/#topologykubernetesiozone).
108
108
-->
109
- 节点启动时,每个节点上的 kubelet 会向 Kubernetes API 中代表该 kubelet 的 Node 对象
110
- 添加 {{< glossary_tooltip text="标签" term_id="label" >}}。
109
+ 节点启动时,每个节点上的 kubelet 会向 Kubernetes API 中代表该 kubelet 的 Node
110
+ 对象添加 {{< glossary_tooltip text="标签" term_id="label" >}}。
111
111
这些标签可能包含[ 区信息] ( /zh-cn/docs/reference/labels-annotations-taints/#topologykubernetesiozone ) 。
112
112
113
113
<!--
@@ -123,11 +123,9 @@ failure affects your whole workload.
123
123
-->
124
124
如果你的集群跨了多个可用区或者地理区域,你可以使用节点标签,结合
125
125
[ Pod 拓扑分布约束] ( /zh-cn/docs/concepts/scheduling-eviction/topology-spread-constraints/ )
126
- 来控制如何在你的集群中多个失效域之间分布 Pods。这里的失效域可以是
127
- 地理区域、可用区甚至是特定节点。
128
- 这些提示信息使得{{< glossary_tooltip text="调度器" term_id="kube-scheduler" >}}
129
- 能够更好地分布 Pods,以实现更好的可用性,降低因为某种失效给整个工作负载
130
- 带来的风险。
126
+ 来控制如何在你的集群中多个失效域之间分布 Pod。这里的失效域可以是地理区域、可用区甚至是特定节点。
127
+ 这些提示信息使得{{< glossary_tooltip text="调度器" term_id="kube-scheduler" >}}能够更好地调度
128
+ Pod,以实现更好的可用性,降低因为某种失效给整个工作负载带来的风险。
131
129
132
130
<!--
133
131
For example, you can set a constraint to make sure that the
@@ -136,8 +134,8 @@ other, whenever that is feasible. You can define this declaratively
136
134
without explicitly defining which availability zones are in use for
137
135
each workload.
138
136
-->
139
- 例如,你可以设置一种约束,确保某个 StatefulSet 中的三个副本都运行在
140
- 不同的可用区中, 只要其他条件允许。你可以通过声明的方式来定义这种约束,
137
+ 例如,你可以设置一种约束,确保某个 StatefulSet 中的 3 个副本都运行在不同的可用区中,
138
+ 只要其他条件允许。你可以通过声明的方式来定义这种约束,
141
139
而不需要显式指定每个工作负载使用哪些可用区。
142
140
143
141
<!--
@@ -151,18 +149,18 @@ Using tools such as the Cluster API you can define sets of machines to run as
151
149
worker nodes for your cluster across multiple failure domains, and rules to
152
150
automatically heal the cluster in case of whole-zone service disruption.
153
151
-->
154
- ### 跨多个区分布节点 {#distributing-nodes-across-zones}
152
+ ### 跨多个区分布节点 {#distributing-nodes-across-zones}
155
153
156
- Kubernetes 的核心逻辑并不会帮你创建节点,你需要自行完成此操作,或者使用
157
- 类似 [ Cluster API] ( https://cluster-api.sigs.k8s.io/ ) 这类工具来替你管理节点。
154
+ Kubernetes 的核心逻辑并不会帮你创建节点,你需要自行完成此操作,或者使用类似
155
+ [ Cluster API] ( https://cluster-api.sigs.k8s.io/ ) 这类工具来替你管理节点。
158
156
159
157
<!--
160
158
Using tools such as the Cluster API you can define sets of machines to run as
161
159
worker nodes for your cluster across multiple failure domains, and rules to
162
160
automatically heal the cluster in case of whole-zone service disruption.
163
161
-->
164
- 使用类似 Cluster API 这类工具,你可以跨多个失效域来定义一组用做你的集群
165
- 工作节点的机器, 以及当整个区的服务出现中断时如何自动治愈集群的策略。
162
+ 使用类似 Cluster API 这类工具,你可以跨多个失效域来定义一组用做你的集群工作节点的机器,
163
+ 以及当整个区的服务出现中断时如何自动治愈集群的策略。
166
164
167
165
<!--
168
166
## Manual zone assignment for Pods
@@ -171,16 +169,15 @@ You can apply [node selector constraints](/docs/concepts/scheduling-eviction/ass
171
169
to Pods that you create, as well as to Pod templates in workload resources
172
170
such as Deployment, StatefulSet, or Job.
173
171
-->
174
- ## 为 Pods 手动指定区
172
+ ## 为 Pod 手动指定区 {#manual-zone-assignment-for-pods}
175
173
176
174
<!--
177
175
You can apply [node selector constraints](/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector)
178
176
to Pods that you create, as well as to Pod templates in workload resources
179
177
such as Deployment, StatefulSet, or Job.
180
178
-->
181
- 你可以应用[ 节点选择算符约束] ( /zh-cn/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector )
182
- 到你所创建的 Pods 上,或者为 Deployment、StatefulSet 或 Job 这类工作负载资源
183
- 中的 Pod 模板设置此类约束。
179
+ 你可以应用[ 节点选择算符约束] ( /zh-cn/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector ) 到你所创建的
180
+ Pod 上,或者为 Deployment、StatefulSet 或 Job 这类工作负载资源中的 Pod 模板设置此类约束。
184
181
185
182
<!--
186
183
## Storage access for zones
@@ -195,12 +192,20 @@ Please note that the method of adding zone labels can depend on your
195
192
cloud provider and the storage provisioner you’re using. Always refer to the specific
196
193
documentation for your environment to ensure correct configuration.
197
194
-->
198
- ## 跨区的存储访问
195
+ ## 跨区的存储访问 {#storage-access-for-zones}
199
196
200
- 当创建持久卷时,Kubernetes 会自动向那些链接到特定区的 PersistentVolume 添加区标签。。
197
+ 当创建持久卷时,Kubernetes 会自动向那些链接到特定区的 PersistentVolume 添加区标签。
201
198
{{< glossary_tooltip text="调度器" term_id="kube-scheduler" >}}通过其
202
- ` NoVolumeZoneConflict ` 断言确保申领给定 PersistentVolume 的 Pods 只会
203
- 被调度到该卷所在的可用区。
199
+ ` NoVolumeZoneConflict ` 断言确保申领给定 PersistentVolume 的 Pod
200
+ 只会被调度到该卷所在的可用区。
201
+
202
+ <!--
203
+ Please note that the method of adding zone labels can depend on your
204
+ cloud provider and the storage provisioner you’re using. Always refer to the specific
205
+ documentation for your environment to ensure correct configuration.
206
+ -->
207
+ 请注意,添加区标签的方法可能取决于你的云提供商和存储制备器。
208
+ 请参阅具体的环境文档,确保配置正确。
204
209
205
210
请注意,添加区标签的方法可能会根据你所使用的云提供商和存储制备器而有所不同。
206
211
为确保配置正确,请始终参阅你的环境的特定文档。
@@ -212,10 +217,11 @@ storage in that class may use.
212
217
To learn about configuring a StorageClass that is aware of failure domains or zones,
213
218
see [Allowed topologies](/docs/concepts/storage/storage-classes/#allowed-topologies).
214
219
-->
215
- 你可以为 PersistentVolumeClaim 指定{{< glossary_tooltip text="StorageClass" term_id="storage-class" >}}
220
+ 你可以为 PersistentVolumeClaim 指定
221
+ {{< glossary_tooltip text="StorageClass" term_id="storage-class" >}}
216
222
以设置该类中的存储可以使用的失效域(区)。
217
- 要了解如何配置能够感知失效域或区的 StorageClass,请参阅
218
- [ 可用的拓扑逻辑] ( /zh-cn/docs/concepts/storage/storage-classes/#allowed-topologies ) 。
223
+ 要了解如何配置能够感知失效域或区的 StorageClass,
224
+ 请参阅 [ 可用的拓扑逻辑] ( /zh-cn/docs/concepts/storage/storage-classes/#allowed-topologies ) 。
219
225
220
226
<!--
221
227
## Networking
@@ -228,13 +234,13 @@ elements. For example, if your cloud provider supports Services with
228
234
same zone as the load balancer element processing a given connection.
229
235
Check your cloud provider's documentation for details.
230
236
-->
231
- ## 网络 {#networking}
237
+ ## 网络 {#networking}
232
238
233
239
Kubernetes 自身不提供与可用区相关的联网配置。
234
240
你可以使用[ 网络插件] ( /zh-cn/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/ )
235
241
来配置集群的联网,该网络解决方案可能拥有一些与可用区相关的元素。
236
- 例如,如果你的云提供商支持 ` type=LoadBalancer ` 的 Service,则负载均衡器
237
- 可能仅会将请求流量发送到运行在负责处理给定连接的负载均衡器组件所在的区 。
242
+ 例如,如果你的云提供商支持 ` type=LoadBalancer ` 的 Service,
243
+ 则负载均衡器可能仅会将请求流量发送到运行在负责处理给定连接的负载均衡器组件所在的区 。
238
244
请查阅云提供商的文档了解详细信息。
239
245
240
246
<!--
@@ -243,8 +249,8 @@ For custom or on-premises deployments, similar considerations apply.
243
249
{{< glossary_tooltip text="Ingress" term_id="ingress" >}} behavior, including handling
244
250
of different failure zones, does vary depending on exactly how your cluster is set up.
245
251
-->
246
- 对于自定义的或本地集群部署,也可以考虑这些因素
247
- {{< glossary_tooltip text="Service" term_id="service" >}}
252
+ 对于自定义的或本地集群部署,也可以考虑这些因素。
253
+ {{< glossary_tooltip text="Service" term_id="service" >}} 和
248
254
{{< glossary_tooltip text="Ingress" term_id="ingress" >}} 的行为,
249
255
包括处理不同失效区的方法,在很大程度上取决于你的集群是如何搭建的。
250
256
@@ -266,11 +272,11 @@ something to consider.
266
272
-->
267
273
## 失效恢复 {#fault-recovery}
268
274
269
- 在搭建集群时,你可能需要考虑当某区域中的所有失效区都同时掉线时,是否以及如何
270
- 恢复服务。 例如,你是否要求在某个区中至少有一个节点能够运行 Pod?
275
+ 在搭建集群时,你可能需要考虑当某区域中的所有失效区都同时掉线时,是否以及如何恢复服务。
276
+ 例如,你是否要求在某个区中至少有一个节点能够运行 Pod?
271
277
请确保任何对集群很关键的修复工作都不要指望集群中至少有一个健康节点。
272
278
例如:当所有节点都不健康时,你可能需要运行某个修复性的 Job,
273
- 该 Job 要设置特定的{{< glossary_tooltip text="容忍度" term_id="toleration" >}}
279
+ 该 Job 要设置特定的{{< glossary_tooltip text="容忍度" term_id="toleration" >}},
274
280
以便修复操作能够至少将一个节点恢复为可用状态。
275
281
276
282
Kubernetes 对这类问题没有现成的解决方案;不过这也是要考虑的因素之一。
@@ -281,6 +287,5 @@ Kubernetes 对这类问题没有现成的解决方案;不过这也是要考虑
281
287
To learn how the scheduler places Pods in a cluster, honoring the configured constraints,
282
288
visit [Scheduling and Eviction](/docs/concepts/scheduling-eviction/).
283
289
-->
284
- 要了解调度器如何在集群中放置 Pods 并遵从所配置的约束,可参阅
285
- [ 调度与驱逐] ( /zh-cn/docs/concepts/scheduling-eviction/ ) 。
286
-
290
+ 要了解调度器如何在集群中放置 Pod 并遵从所配置的约束,
291
+ 可参阅[ 调度与驱逐] ( /zh-cn/docs/concepts/scheduling-eviction/ ) 。
0 commit comments