Skip to content

Commit fc22259

Browse files
committed
kubeadm-reset: add notes about more manual cleanup steps
1 parent 0aad8f5 commit fc22259

File tree

1 file changed

+62
-1
lines changed

1 file changed

+62
-1
lines changed

content/en/docs/reference/setup-tools/kubeadm/kubeadm-reset.md

+62-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ etcd member of this node from the etcd cluster.
2222
To skip a list of phases you can use the `--skip-phases` flag, which works in a similar way to
2323
the `kubeadm join` and `kubeadm init` phase runners.
2424

25-
### External etcd clean up
25+
`kubeadm reset` also supports the `--config` flag for passing
26+
a [`ResetConfiguration` structure](/docs/reference/config-api/kubeadm-config.v1beta4/).
27+
28+
### Cleanup of external etcd members
2629

2730
`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.
2831

@@ -34,6 +37,64 @@ etcdctl del "" --prefix
3437

3538
See the [etcd documentation](https://github.com/coreos/etcd/tree/master/etcdctl) for more information.
3639

40+
### Cleanup of CNI configuration
41+
42+
CNI plugins use the directory `/etc/cni/net.d` to store their configuration.
43+
The `kubeadm reset` command does not cleanup that directory. Leaving the configuration
44+
of a CNI plugin on a host can be problematic if the same host is later used
45+
as a new Kubernetes node and a different CNI plugin happens to be deployed in that cluster.
46+
It can result in a configuration conflict between CNI plugins.
47+
48+
To cleanup the directory, backup its contents if needed and then execute
49+
the following command:
50+
51+
```bash
52+
sudo rm -rf /etc/cni/net.d
53+
```
54+
55+
### Cleanup of network traffic rules
56+
57+
The `kubeadm reset` command does not clean any iptables, nftables or IPVS rules applied
58+
to the host by kube-proxy. A control loop in kube-proxy ensures that the rules on each node
59+
host are synchronized. For additional details please see
60+
[Virtual IPs and Service Proxies](/docs/reference/networking/virtual-ips/).
61+
62+
Leaving the rules without cleanup should not cause any issues if the host is
63+
later reused as a Kubernetes node or if it will serve a different purpose.
64+
65+
If you wish to perform this cleanup, you can use the same kube-proxy container
66+
which was used in your cluster and the `--cleanup` flag of the
67+
`kube-proxy` binary:
68+
69+
```bash
70+
docker run --privileged --rm registry.k8s.io/kube-proxy:v{{< skew currentPatchVersion >}} sh -c "kube-proxy --cleanup && echo DONE"
71+
```
72+
73+
The output of the above command should print `DONE` at the end.
74+
Instead of Docker, you can use your preferred container runtime to start the container.
75+
76+
### Cleanup of $HOME/.kube
77+
78+
The `$HOME/.kube` directory typically contains configuration files and kubectl cache.
79+
While not cleaning the contents of `$HOME/.kube/cache` is not an issue, there is one important
80+
file in the directory. That is `$HOME/.kube/config` and it is used by kubectl to authenticate
81+
to the Kubernetes API server. After `kubeadm init` finishes, the user is instructed to copy the
82+
`/etc/kubernetes/admin.conf` file to the `$HOME/.kube/config` location and grant the current
83+
user access to it.
84+
85+
The `kubeadm reset` command does not clean any of the contents of the `$HOME/.kube` directory.
86+
Leaving the `$HOME/.kube/config` file without deleting it, can be problematic depending
87+
on who will have access to this host after `kubeadm reset` was called.
88+
If the same cluster continues to exist, it is highly recommended to delete the file,
89+
as the admin credentials stored in it will continue to be valid.
90+
91+
To cleanup the directory, examine its contents, perform backup if needed and execute
92+
the following command:
93+
94+
```bash
95+
rm -rf $HOME/.kube
96+
```
97+
3798
### Graceful kube-apiserver shutdown
3899

39100
If you have your `kube-apiserver` configured with the `--shutdown-delay-duration` flag,

0 commit comments

Comments
 (0)