Change IP of existing master in k3s for single node, single master
When we want to change our node ip of the k3s cluster, what we gone do to achieve it.
Change IP of existing master in k3s for single node, single master
When we want to change our node ip of the k3s cluster, what we gone do to achieve it.
It depends on the datastore that the k3s using.
ETCD
when k3s using etcd as datastore, we should reinit the cluster to get the new ip.
Stop the k3s service
systemctl stop k3s
In k3s, snapshots are enabled by default, at 00:00 and 12:00 system time, with 5 snapshots retained. To configure the snapshot interval or the number of retained snapshots, refer to the options.
The snapshot directory defaults to ${data-dir}/server/db/snapshots. The data-dir value defaults to /var/lib/rancher/k3s and can be changed by setting the --data-dir flag.
The token is in${data-dir}/server/token
We using --cluster-reset and --cluster-reset-restore-path to reset the cluster and restore the cluster from the etcd snapshots.
k3s server
--docker
--cluster-init
--disable traefik
--data-dir /asteria/rancher/k3s
--kubelet-arg max-pods=300
--service-node-port-range 30000-31
--cluster-reset
--cluster-reset-restore-path=/asteria/rancher/k3s/server/db/snapshots/{latest snapshot}
--token={token}
You can also set --flannel-backend host-gwin k3s server args to get better cni performance when in single node single master
SQLite / MySQL / PostgresQL
when k3s server starts without --cluster-init args, the default datasource will be sqlite, you can also set other datasource ,such as mysql or pg base on the doc.
It’s will be much simple when you using this datastore. What we only need to do is deleting the node manually.
kubectl delete no {nodename}
Restart k3s Service
After following the steps, we need to restart the k3s service.
systemctl restart k3s
You can get the latest node info by commandkubectl get no -o wide, you will see the new ip address.
Conclusions
When in some edge case or some test case, we run k3s on single on single master, and we can change the ip address of the node quickly by the steps above.
If I am wrong , please correct me, and let me know.
Thanks for reading.
메타데이터
- post_id
- 87e92f2d2b6c
- slug
- change-ip-of-existing-master-in-k3s-for-single-node-single-master-87e92f2d2b6c
- url
- https://medium.com/@taozhi/change-ip-of-existing-master-in-k3s-for-single-node-single-master-87e92f2d2b6c
- canonical_url
- https://medium.com/@taozhi/change-ip-of-existing-master-in-k3s-for-single-node-single-master-87e92f2d2b6c
- author_url
- https://medium.com/@taozhi
- status
- ok
- fetched_at
- 2026-08-04 17:06:07