Erika
Erika

Reputation: 609

How to switch the master node in kubernetes?

I have a k8s cluster with one master node (node one) and three worker nodes(node two, three, and four). Is there any way to change node two to the master node and change node one to the worker node? In other words, switch the role of node one and node two.

Thanks

Upvotes: 2

Views: 5325

Answers (2)

Behdin Talebi
Behdin Talebi

Reputation: 31

you have to drain node 2 from cluster aftar that you should connect node to as master or contorlplane to cluster then you can do this steps for node 1

  1. drain the node 2)Kubeadm reset the worker node
  2. Run “kubeadm init phase upload-certs --upload-certs” to create a new cert for joining control plane
  3. Run “kubeadm token create --print-join-command”

Upvotes: 0

gohm'c
gohm'c

Reputation: 15548

Is there any way to change node two to the master node and change node one to the worker node?

K8s control plane (aka master) is make up of kubectl get componentstatuses. This is not like docker node promote/demote. In your case, you need to delete node 2 from the cluster, re-join the cluster as control plane. Then delete node 1 and re-join as worker node.

Upvotes: 1

Related Questions