Skip to content

Commit 8ab0e61

Browse files
author
zhuzhenghao
committed
[zh] sync setup-ha-etcd-with-kubeadm.md
1 parent 865eb41 commit 8ab0e61

File tree

1 file changed

+41
-36
lines changed

1 file changed

+41
-36
lines changed

content/zh-cn/docs/setup/production-environment/tools/kubeadm/setup-ha-etcd-with-kubeadm.md

Lines changed: 41 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ weight: 70
1818
<!--
1919
While kubeadm is being used as the management tool for external etcd nodes
2020
in this guide, please note that kubeadm does not plan to support certificate rotation
21-
or upgrades for such nodes. The long term plan is to empower the tool
21+
or upgrades for such nodes. The long-term plan is to empower the tool
2222
[etcdadm](https://github.com/kubernetes-sigs/etcdadm) to manage these
2323
aspects.
2424
-->
@@ -46,27 +46,30 @@ etcd cluster of three members that can be used by kubeadm during cluster creatio
4646
## {{% heading "prerequisites" %}}
4747

4848
<!--
49-
* Three hosts that can talk to each other over TCP ports 2379 and 2380. This document assumes these default ports. However, they are configurable through the kubeadm config file.
49+
- Three hosts that can talk to each other over TCP ports 2379 and 2380. This
50+
document assumes these default ports. However, they are configurable through
51+
the kubeadm config file.
5052
-->
51-
* 三个可以通过 2379 和 2380 端口相互通信的主机。本文档使用这些作为默认端口。不过,它们可以通过 kubeadm 的配置文件进行自定义。
53+
- 三个可以通过 2379 和 2380 端口相互通信的主机。本文档使用这些作为默认端口。不过,它们可以通过 kubeadm 的配置文件进行自定义。
5254
<!--
53-
* Each host must have systemd and a bash compatible shell installed.
54-
* Each host must [have a container runtime, kubelet, and kubeadm installed](/docs/setup/production-environment/tools/kubeadm/install-kubeadm/).
55+
- Each host must have systemd and a bash compatible shell installed.
56+
- Each host must [have a container runtime, kubelet, and kubeadm installed](/docs/setup/production-environment/tools/kubeadm/install-kubeadm/).
5557
-->
56-
* 每个主机必须安装 systemd 和 bash 兼容的 shell。
57-
* 每台主机必须[安装有容器运行时、kubelet 和 kubeadm](/zh-cn/docs/setup/production-environment/tools/kubeadm/install-kubeadm/)
58+
- 每个主机必须安装 systemd 和 bash 兼容的 shell。
59+
- 每台主机必须[安装有容器运行时、kubelet 和 kubeadm](/zh-cn/docs/setup/production-environment/tools/kubeadm/install-kubeadm/)
5860
<!--
59-
* Each host should have access to the Kubernetes container image registry (`registry.k8s.io`) or list/pull the required etcd image using
60-
`kubeadm config images list/pull`. This guide will setup etcd instances as
61-
[static pods](/docs/tasks/configure-pod-container/static-pod/) managed by a kubelet.
61+
- Each host should have access to the Kubernetes container image registry (`registry.k8s.io`) or list/pull the required etcd image using
62+
`kubeadm config images list/pull`. This guide will set up etcd instances as
63+
[static pods](/docs/tasks/configure-pod-container/static-pod/) managed by a kubelet.
6264
-->
63-
* 每个主机都应该能够访问 Kubernetes 容器镜像仓库 (registry.k8s.io),
64-
或者使用 `kubeadm config images list/pull` 列出/拉取所需的 etcd 镜像。
65-
本指南将把 etcd 实例设置为由 kubelet 管理的[静态 Pod](/zh-cn/docs/tasks/configure-pod-container/static-pod/)
65+
- 每个主机都应该能够访问 Kubernetes 容器镜像仓库 (registry.k8s.io),
66+
或者使用 `kubeadm config images list/pull` 列出/拉取所需的 etcd 镜像。
67+
本指南将把 etcd 实例设置为由 kubelet 管理的[静态 Pod](/zh-cn/docs/tasks/configure-pod-container/static-pod/)
6668
<!--
67-
* Some infrastructure to copy files between hosts. For example `ssh` and `scp` can satisfy this requirement.
69+
- Some infrastructure to copy files between hosts. For example `ssh` and `scp`
70+
can satisfy this requirement.
6871
-->
69-
* 一些可以用来在主机间复制文件的基础设施。例如 `ssh``scp` 就可以满足需求。
72+
- 一些可以用来在主机间复制文件的基础设施。例如 `ssh``scp` 就可以满足需求。
7073

7174
<!-- steps -->
7275

@@ -76,13 +79,16 @@ etcd cluster of three members that can be used by kubeadm during cluster creatio
7679
## 建立集群
7780

7881
<!--
79-
The general approach is to generate all certs on one node and only distribute the *necessary* files to the other nodes.
82+
The general approach is to generate all certs on one node and only distribute
83+
the _necessary_ files to the other nodes.
8084
-->
81-
一般来说,是在一个节点上生成所有证书并且只分发这些*必要*的文件到其它节点上。
85+
一般来说,是在一个节点上生成所有证书并且只分发这些**必要**的文件到其它节点上。
8286

8387
{{< note >}}
8488
<!--
85-
kubeadm contains all the necessary cryptographic machinery to generate the certificates described below; no other cryptographic tooling is required for this example.
89+
kubeadm contains all the necessary cryptographic machinery to generate
90+
the certificates described below; no other cryptographic tooling is required for
91+
this example.
8692
-->
8793
kubeadm 包含生成下述证书所需的所有必要的密码学工具;在这个例子中,不需要其他加密工具。
8894
{{< /note >}}
@@ -119,7 +125,7 @@ on Kubernetes dual-stack support see [Dual-stack support with kubeadm](/docs/set
119125
# 将下面的 "systemd" 替换为你的容器运行时所使用的 cgroup 驱动。
120126
# kubelet 的默认值为 "cgroupfs"。
121127
# 如果需要的话,将 "--container-runtime-endpoint " 的值替换为一个不同的容器运行时。
122-
ExecStart=/usr/bin/kubelet --address=127.0.0.1 --pod-manifest-path=/etc/kubernetes/manifests --cgroup-driver=systemd
128+
ExecStart=/usr/bin/kubelet --address=127.0.0.1 --pod-manifest-path=/etc/kubernetes/manifests --cgroup-driver=systemd --container-runtime=remote --container-runtime-endpoint=unix:///var/run/containerd/containerd.sock
123129
Restart=always
124130
EOF
125131
@@ -196,7 +202,7 @@ on Kubernetes dual-stack support see [Dual-stack support with kubeadm](/docs/set
196202
```
197203
198204
<!--
199-
1. Generate the certificate authority
205+
1. Generate the certificate authority.
200206
201207
If you already have a CA then the only action that is copying the CA's `crt` and
202208
`key` file to `/etc/kubernetes/pki/etcd/ca.crt` and
@@ -219,15 +225,15 @@ on Kubernetes dual-stack support see [Dual-stack support with kubeadm](/docs/set
219225
```
220226
221227
<!--
222-
This creates two files
228+
This creates two files:
223229
-->
224230
这一操作创建如下两个文件:
225231
226232
- `/etc/kubernetes/pki/etcd/ca.crt`
227233
- `/etc/kubernetes/pki/etcd/ca.key`
228234
229235
<!--
230-
1. Create certificates for each member
236+
1. Create certificates for each member.
231237
-->
232238
4. 为每个成员创建证书
233239
@@ -259,7 +265,7 @@ on Kubernetes dual-stack support see [Dual-stack support with kubeadm](/docs/set
259265
```
260266
261267
<!--
262-
1. Copy certificates and kubeadm configs
268+
1. Copy certificates and kubeadm configs.
263269
The certificates have been generated and now they must be moved to their
264270
respective hosts.
265271
-->
@@ -278,7 +284,7 @@ on Kubernetes dual-stack support see [Dual-stack support with kubeadm](/docs/set
278284
```
279285
280286
<!--
281-
1. Ensure all expected files exist
287+
1. Ensure all expected files exist.
282288
283289
The complete list of required files on `$HOST0` is:
284290
-->
@@ -327,7 +333,7 @@ on Kubernetes dual-stack support see [Dual-stack support with kubeadm](/docs/set
327333
```
328334
329335
<!--
330-
On `$HOST2`
336+
On `$HOST2`:
331337
-->
332338
在 `$HOST2` 上:
333339
@@ -349,7 +355,7 @@ on Kubernetes dual-stack support see [Dual-stack support with kubeadm](/docs/set
349355
```
350356
351357
<!--
352-
1. Create the static pod manifests
358+
1. Create the static pod manifests.
353359
354360
Now that the certificates and configs are in place it's time to create the
355361
manifests. On each host run the `kubeadm` command to generate a static manifest
@@ -361,13 +367,13 @@ on Kubernetes dual-stack support see [Dual-stack support with kubeadm](/docs/set
361367
在每台主机上运行 `kubeadm` 命令来生成 etcd 使用的静态清单。
362368
363369
```shell
364-
root@HOST0 $ kubeadm init phase etcd local --config=/tmp/${HOST0}/kubeadmcfg.yaml
365-
root@HOST1 $ kubeadm init phase etcd local --config=$HOME/kubeadmcfg.yaml
366-
root@HOST2 $ kubeadm init phase etcd local --config=$HOME/kubeadmcfg.yaml
370+
root@HOST0 $ kubeadm init phase etcd local --config=/tmp/${HOST0}/kubeadmcfg.yaml
371+
root@HOST1 $ kubeadm init phase etcd local --config=$HOME/kubeadmcfg.yaml
372+
root@HOST2 $ kubeadm init phase etcd local --config=$HOME/kubeadmcfg.yaml
367373
```
368374
369375
<!--
370-
1. Optional: Check the cluster health
376+
1. Optional: Check the cluster health.
371377
-->
372378
8. 可选:检查集群运行状况
373379
@@ -385,8 +391,8 @@ on Kubernetes dual-stack support see [Dual-stack support with kubeadm](/docs/set
385391
https://[HOST2 IP]:2379 is healthy: successfully committed proposal: took = 35.926451ms
386392
```
387393
<!--
388-
Set ${ETCD_TAG} to the version tag of your etcd image. For example 3.4.3-0. To see the etcd image and tag that kubeadm uses execute kubeadm config images list --kubernetes-version ${K8S_VERSION}, where ${K8S_VERSION} is for example v1.17.0
389-
Set ${HOST0}to the IP address of the host you are testing.
394+
- Set `${ETCD_TAG}` to the version tag of your etcd image. For example `3.4.3-0`. To see the etcd image and tag that kubeadm uses execute `kubeadm config images list --kubernetes-version ${K8S_VERSION}`, where `${K8S_VERSION}` is for example `v1.17.0`.
395+
- Set `${HOST0}`to the IP address of the host you are testing.
390396
-->
391397
- 将 `${ETCD_TAG}` 设置为你的 etcd 镜像的版本标签,例如 `3.4.3-0`
392398
要查看 kubeadm 使用的 etcd 镜像和标签,请执行
@@ -397,11 +403,10 @@ on Kubernetes dual-stack support see [Dual-stack support with kubeadm](/docs/set
397403
## {{% heading "whatsnext" %}}
398404
399405
<!--
400-
Once your have a working 3 member etcd cluster, you can continue setting up a
401-
highly available control plane using the [external etcd method with
402-
kubeadm](/docs/setup/independent/high-availability/).
406+
Once you have an etcd cluster with 3 working members, you can continue setting up a
407+
highly available control plane using the
408+
[external etcd method with kubeadm](/docs/setup/production-environment/tools/kubeadm/high-availability/).
403409
-->
404410
一旦拥有了一个正常工作的 3 成员的 etcd 集群,你就可以基于
405411
[使用 kubeadm 外部 etcd 的方法](/zh-cn/docs/setup/production-environment/tools/kubeadm/high-availability/),
406412
继续部署一个高可用的控制平面。
407-

0 commit comments

Comments
 (0)