Skip to content

Commit cf98ccc

Browse files
committed
[zh-cn] Resync setup etcd HA cluster page
1 parent a9b7331 commit cf98ccc

File tree

1 file changed

+41
-44
lines changed

1 file changed

+41
-44
lines changed

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

Lines changed: 41 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,17 @@ The general approach is to generate all certs on one node and only distribute th
7676

7777
{{< note >}}
7878
<!--
79-
kubeadm contains all the necessary crytographic machinery to generate the certificates described below; no other cryptographic tooling is required for this example.
79+
kubeadm contains all the necessary cryptographic machinery to generate the certificates described below; no other cryptographic tooling is required for this example.
8080
-->
8181
kubeadm 包含生成下述证书所需的所有必要的密码学工具;在这个例子中,不需要其他加密工具。
8282
{{< /note >}}
8383

84-
<!--
8584
{{< note >}}
85+
<!--
8686
The examples below use IPv4 addresses but you can also configure kubeadm, the kubelet and etcd
8787
to use IPv6 addresses. Dual-stack is supported by some Kubernetes options, but not by etcd. For more details
8888
on Kubernetes dual-stack support see [Dual-stack support with kubeadm](/docs/setup/production-environment/tools/kubeadm/dual-stack-support/).
89-
{{< /note >}}
9089
-->
91-
92-
{{< note >}}
9390
下面的例子使用 IPv4 地址,但是你也可以使用 IPv6 地址配置 kubeadm、kubelet 和 etcd。一些 Kubernetes 选项支持双协议栈,但是 etcd 不支持。
9491
关于 Kubernetes 双协议栈支持的更多细节,请参见 [kubeadm 的双栈支持](/zh-cn/docs/setup/production-environment/tools/kubeadm/dual-stack-support/)
9592
{{< /note >}}
@@ -127,7 +124,6 @@ on Kubernetes dual-stack support see [Dual-stack support with kubeadm](/docs/set
127124
<!--
128125
Check the kubelet status to ensure it is running.
129126
-->
130-
131127
检查 kubelet 的状态以确保其处于运行状态:
132128
133129
```shell
@@ -150,47 +146,47 @@ on Kubernetes dual-stack support see [Dual-stack support with kubeadm](/docs/set
150146
export HOST1=10.0.0.7
151147
export HOST2=10.0.0.8
152148
153-
# 使用你的主机名更新 NAME0, NAME1 和 NAME2
154-
export NAME0="infra0"
155-
export NAME1="infra1"
156-
export NAME2="infra2"
149+
# 使用你的主机名更新 NAME0NAME1 和 NAME2
150+
export NAME0="infra0"
151+
export NAME1="infra1"
152+
export NAME2="infra2"
157153
158154
# 创建临时目录来存储将被分发到其它主机上的文件
159155
mkdir -p /tmp/${HOST0}/ /tmp/${HOST1}/ /tmp/${HOST2}/
160156
161-
HOSTS=(${HOST0} ${HOST1} ${HOST2})
162-
NAMES=(${NAME0} ${NAME1} ${NAME2})
163-
164-
for i in "${!HOSTS[@]}"; do
165-
HOST=${HOSTS[$i]}
166-
NAME=${NAMES[$i]}
167-
cat << EOF > /tmp/${HOST}/kubeadmcfg.yaml
168-
---
169-
apiVersion: "kubeadm.k8s.io/v1beta3"
170-
kind: InitConfiguration
171-
nodeRegistration:
172-
name: ${NAME}
173-
localAPIEndpoint:
174-
advertiseAddress: ${HOST}
175-
---
176-
apiVersion: "kubeadm.k8s.io/v1beta3"
177-
kind: ClusterConfiguration
178-
etcd:
179-
local:
180-
serverCertSANs:
181-
- "${HOST}"
182-
peerCertSANs:
183-
- "${HOST}"
184-
extraArgs:
185-
initial-cluster: ${NAMES[0]}=https://${HOSTS[0]}:2380,${NAMES[1]}=https://${HOSTS[1]}:2380,${NAMES[2]}=https://${HOSTS[2]}:2380
186-
initial-cluster-state: new
187-
name: ${NAME}
188-
listen-peer-urls: https://${HOST}:2380
189-
listen-client-urls: https://${HOST}:2379
190-
advertise-client-urls: https://${HOST}:2379
191-
initial-advertise-peer-urls: https://${HOST}:2380
192-
EOF
193-
done
157+
HOSTS=(${HOST0} ${HOST1} ${HOST2})
158+
NAMES=(${NAME0} ${NAME1} ${NAME2})
159+
160+
for i in "${!HOSTS[@]}"; do
161+
HOST=${HOSTS[$i]}
162+
NAME=${NAMES[$i]}
163+
cat << EOF > /tmp/${HOST}/kubeadmcfg.yaml
164+
---
165+
apiVersion: "kubeadm.k8s.io/v1beta3"
166+
kind: InitConfiguration
167+
nodeRegistration:
168+
name: ${NAME}
169+
localAPIEndpoint:
170+
advertiseAddress: ${HOST}
171+
---
172+
apiVersion: "kubeadm.k8s.io/v1beta3"
173+
kind: ClusterConfiguration
174+
etcd:
175+
local:
176+
serverCertSANs:
177+
- "${HOST}"
178+
peerCertSANs:
179+
- "${HOST}"
180+
extraArgs:
181+
initial-cluster: ${NAMES[0]}=https://${HOSTS[0]}:2380,${NAMES[1]}=https://${HOSTS[1]}:2380,${NAMES[2]}=https://${HOSTS[2]}:2380
182+
initial-cluster-state: new
183+
name: ${NAME}
184+
listen-peer-urls: https://${HOST}:2380
185+
listen-client-urls: https://${HOST}:2379
186+
advertise-client-urls: https://${HOST}:2379
187+
initial-advertise-peer-urls: https://${HOST}:2380
188+
EOF
189+
done
194190
```
195191
196192
<!--
@@ -219,7 +215,7 @@ on Kubernetes dual-stack support see [Dual-stack support with kubeadm](/docs/set
219215
<!--
220216
This creates two files
221217
-->
222-
这一操作创建如下两个文件
218+
这一操作创建如下两个文件
223219
224220
- `/etc/kubernetes/pki/etcd/ca.crt`
225221
- `/etc/kubernetes/pki/etcd/ca.key`
@@ -402,3 +398,4 @@ kubeadm](/docs/setup/independent/high-availability/).
402398
一旦拥有了一个正常工作的 3 成员的 etcd 集群,你就可以基于
403399
[使用 kubeadm 外部 etcd 的方法](/zh-cn/docs/setup/production-environment/tools/kubeadm/high-availability/),
404400
继续部署一个高可用的控制平面。
401+

0 commit comments

Comments
 (0)