Skip to content

Commit e1eac16

Browse files
authored
Merge pull request #49504 from windsonsea/resetyh
[zh] Sync kubeadm/kubeadm-reset.md
2 parents e0bbb9a + 317fd77 commit e1eac16

File tree

1 file changed

+106
-2
lines changed

1 file changed

+106
-2
lines changed

content/zh-cn/docs/reference/setup-tools/kubeadm/kubeadm-reset.md

Lines changed: 106 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,16 @@ the `kubeadm join` and `kubeadm init` phase runners.
4545
要跳过阶段列表,你可以使用 `--skip-phases` 参数,该参数的工作方式类似于 `kubeadm join``kubeadm init` 阶段运行器。
4646

4747
<!--
48-
### External etcd clean up
48+
`kubeadm reset` also supports the `--config` flag for passing
49+
a [`ResetConfiguration` structure](/docs/reference/config-api/kubeadm-config.v1beta4/).
4950
-->
50-
### 外部 etcd 清理 {#external-etcd-clean-up}
51+
`kubeadm reset` 也支持使用 `--config` 参数来传递
52+
[`ResetConfiguration` 结构](/zh-cn/docs/reference/config-api/kubeadm-config.v1beta4/)
53+
54+
<!--
55+
### Cleanup of external etcd members
56+
-->
57+
### 清理外部 etcd 成员 {#cleanup-of-external-etcd-members}
5158

5259
<!--
5360
`kubeadm reset` will not delete any etcd data if external etcd is used. This means that if you run `kubeadm init` again using the same etcd endpoints, you will see state from previous clusters.
@@ -69,6 +76,103 @@ See the [etcd documentation](https://github.com/coreos/etcd/tree/master/etcdctl)
6976
-->
7077
更多详情请参考 [etcd 文档](https://github.com/coreos/etcd/tree/master/etcdctl)
7178

79+
<!--
80+
### Cleanup of CNI configuration
81+
82+
CNI plugins use the directory `/etc/cni/net.d` to store their configuration.
83+
The `kubeadm reset` command does not cleanup that directory. Leaving the configuration
84+
of a CNI plugin on a host can be problematic if the same host is later used
85+
as a new Kubernetes node and a different CNI plugin happens to be deployed in that cluster.
86+
It can result in a configuration conflict between CNI plugins.
87+
-->
88+
### 清理 CNI 配置 {#cleanup-of-cni-configuration}
89+
90+
CNI 插件使用 `/etc/cni/net.d` 目录来存储其配置。
91+
`kubeadm reset` 命令不会清理该目录。
92+
如果同一个主机之后被用作新的 Kubernetes 节点,并且另一个 CNI 插件要被部署到该集群中,
93+
那在主机上保留 CNI 插件的配置可能会出现问题。这可能会导致 CNI 插件之间的配置冲突。
94+
95+
<!--
96+
To cleanup the directory, backup its contents if needed and then execute
97+
the following command:
98+
-->
99+
要清理此目录,必要时先备份其内容,再执行以下命令:
100+
101+
```bash
102+
sudo rm -rf /etc/cni/net.d
103+
```
104+
105+
<!--
106+
### Cleanup of network traffic rules
107+
108+
The `kubeadm reset` command does not clean any iptables, nftables or IPVS rules applied
109+
to the host by kube-proxy. A control loop in kube-proxy ensures that the rules on each node
110+
host are synchronized. For additional details please see
111+
[Virtual IPs and Service Proxies](/docs/reference/networking/virtual-ips/).
112+
-->
113+
### 清理网络流量规则 {#cleanup-of-network-traffic-rules}
114+
115+
`kubeadm reset` 命令不会清理由 kube-proxy 应用到主机的任何 iptables、nftables 或 IPVS 规则。
116+
kube-proxy 中的控制循环确保每个节点主机上的规则是同步的。
117+
有关细节请参阅[虚拟 IP 和服务代理](/zh-cn/docs/reference/networking/virtual-ips/)
118+
119+
<!--
120+
Leaving the rules without cleanup should not cause any issues if the host is
121+
later reused as a Kubernetes node or if it will serve a different purpose.
122+
123+
If you wish to perform this cleanup, you can use the same kube-proxy container
124+
which was used in your cluster and the `--cleanup` flag of the
125+
`kube-proxy` binary:
126+
-->
127+
如果主机之后被重新用作 Kubernetes 节点或将其用于其他目的,不清理这些规则应该不会导致任何问题。
128+
129+
如果你希望执行此清理操作,可以使用集群中使用过的相同 kube-proxy 容器以及
130+
`kube-proxy` 可执行文件的 `--cleanup` 参数:
131+
132+
<!--
133+
The output of the above command should print `DONE` at the end.
134+
Instead of Docker, you can use your preferred container runtime to start the container.
135+
-->
136+
上一条命令的输出应该在最后打印 `DONE`。除了 Docker,你还可以使用自己喜欢的容器运行时来启动容器。
137+
138+
<!--
139+
### Cleanup of $HOME/.kube
140+
141+
The `$HOME/.kube` directory typically contains configuration files and kubectl cache.
142+
While not cleaning the contents of `$HOME/.kube/cache` is not an issue, there is one important
143+
file in the directory. That is `$HOME/.kube/config` and it is used by kubectl to authenticate
144+
to the Kubernetes API server. After `kubeadm init` finishes, the user is instructed to copy the
145+
`/etc/kubernetes/admin.conf` file to the `$HOME/.kube/config` location and grant the current
146+
user access to it.
147+
-->
148+
### $HOME/.kube 的清理 {#cleanup-of-home-kube}
149+
150+
`$HOME/.kube` 目录通常包含配置文件和 kubectl 缓存。
151+
虽然不清理 `$HOME/.kube/cache` 的内容不是问题,但该目录中有一个重要文件。
152+
`$HOME/.kube/config`,kubectl 使用此文件来对 Kubernetes API 服务器实施身份验证。
153+
`kubeadm init` 执行完成后,用户会被指示将 `/etc/kubernetes/admin.conf`
154+
文件复制到 `$HOME/.kube/config` 位置,并授予当前用户对其的访问权限。
155+
156+
<!--
157+
The `kubeadm reset` command does not clean any of the contents of the `$HOME/.kube` directory.
158+
Leaving the `$HOME/.kube/config` file without deleting it, can be problematic depending
159+
on who will have access to this host after `kubeadm reset` was called.
160+
If the same cluster continues to exist, it is highly recommended to delete the file,
161+
as the admin credentials stored in it will continue to be valid.
162+
163+
To cleanup the directory, examine its contents, perform backup if needed and execute
164+
the following command:
165+
-->
166+
`kubeadm reset` 命令不会清理 `$HOME/.kube` 目录中的任何内容。
167+
不删除 `$HOME/.kube/config` 文件可能会产生问题,具体取决于在调用 `kubeadm reset` 之后谁将有权访问此主机。
168+
如果同一集群仍然存在,强烈建议删除此文件,因为存放在其中的管理员凭证将继续有效。
169+
170+
要清理此目录,先检查其内容,必要时执行备份,再执行以下命令:
171+
172+
```bash
173+
rm -rf $HOME/.kube
174+
```
175+
72176
<!--
73177
### Graceful kube-apiserver shutdown
74178

0 commit comments

Comments
 (0)