Professional Documents
Culture Documents
How To Join Master Node or Control Plane To Kubernetes Cluster - by Amir Ad - May, 2024 - Medium
How To Join Master Node or Control Plane To Kubernetes Cluster - by Amir Ad - May, 2024 - Medium
You might want to add a new master node to your new or existing Kubernetes
cluster or change a worker node role to master but do not know how it is done, in
this article, you will learn how to have multiple control plane nodes on your
Kubernetes cluster to prevent any failover on your operational cluster.
In this article, we are going to talk about two scenarios for your cluster, in the first
scenario you are about to initialize your cluster, and in the second scenario you
already have a cluster and want to add 2 or additional master nodes.
https://medium.com/@amirhosseineidy/how-to-join-master-node-or-control-plane-to-kubernetes-cluster-e16be68459bf 1/14
6/11/24, 10:21 PM How to join master node or control plane to Kubernetes cluster | by Amir Ad | May, 2024 | Medium
- -upload certs: As you might know, the connection between master nodes is
mTLS, so both nodes must be authorized in this protocol. This flag helps you to
retrieve Kubernetes certificate modules on your master nodes so executing it is
necessary.
- -control-plan-endpoint: Another useful flag that comes in handy when you add
a new master to an existing cluster so the new master nodes would recognize
the first and primary master node.
- -service-cidr: You will allocate your desired Kubernetes service IP rang here.
try to avoid using the same IP rang pod network.
Open in
- -pod-network-cidr: As it mentioned app
before, pods IPs get allocated from the
range you define here.
Search
- -apiserver-advertise-address= The IP address the API Server will advertise it’s
listening on. If not set the default network interface will be used.
https://medium.com/@amirhosseineidy/how-to-join-master-node-or-control-plane-to-kubernetes-cluster-e16be68459bf 2/14
6/11/24, 10:21 PM How to join master node or control plane to Kubernetes cluster | by Amir Ad | May, 2024 | Medium
This is the result you are going to see on your terminal after initializing your cluster.
As you see the the first command is for joining the additional control plan and the
second one is for joining worker node.
When you see this page, the new master is joined. You might face the etcd error but
you can ignore it anyway and make your .kube file on your home directory by the
instruction that is shown.
Joining worker node is easy, just copy and paste the above command which you saw
on the terminal.
After joining both nodes and installing your kubernetes network plugin, your
cluster with 2 master nodes and 1 worker node is ready.
If you do not intend to reinitialize your existing and operational cluster, we have
another solution for you.
1. Make sure to have openssl installed and run the below command on your master
node:
This command extracts the public key from the CA certificate, converts it to DER
format, and then calculates the SHA-256 hash of the public key. The resulting hash is
what you need for the --discovery-token-ca-cert-hash flag. You should also add
“sha256:” before the string you retrieved on your command.
2. If you have not run your kubeadm init command with - -upload-certs flag, you
should copy your cluster certificates manually to your additional master node. Copy
certificates from /etc/Kubernetes/pki directory.
·ca.crt
· ca.key
· sa.key
· sa.pub
· front-proxy-ca.crt
· front-proxy-ca.key
https://medium.com/@amirhosseineidy/how-to-join-master-node-or-control-plane-to-kubernetes-cluster-e16be68459bf 5/14
6/11/24, 10:21 PM How to join master node or control plane to Kubernetes cluster | by Amir Ad | May, 2024 | Medium
Now everything is ready to join your new control plane to kubeadm cluster with
below command, copy token and hash cert here:
https://medium.com/@amirhosseineidy/how-to-join-master-node-or-control-plane-to-kubernetes-cluster-e16be68459bf 6/14
6/11/24, 10:21 PM How to join master node or control plane to Kubernetes cluster | by Amir Ad | May, 2024 | Medium
Follow
Written by Amir Ad
33 Followers
DevOps engineer and system administrator with more than 3 years experience in enterprise and startup
projects. linkedin: https://www.linkedin.com/in/amir-eydi/
Amir Ad
https://medium.com/@amirhosseineidy/how-to-join-master-node-or-control-plane-to-kubernetes-cluster-e16be68459bf 7/14
6/11/24, 10:21 PM How to join master node or control plane to Kubernetes cluster | by Amir Ad | May, 2024 | Medium
63 3
Amir Ad
61 1
https://medium.com/@amirhosseineidy/how-to-join-master-node-or-control-plane-to-kubernetes-cluster-e16be68459bf 8/14
6/11/24, 10:21 PM How to join master node or control plane to Kubernetes cluster | by Amir Ad | May, 2024 | Medium
Amir Ad
Amir Ad
https://medium.com/@amirhosseineidy/how-to-join-master-node-or-control-plane-to-kubernetes-cluster-e16be68459bf 9/14
6/11/24, 10:21 PM How to join master node or control plane to Kubernetes cluster | by Amir Ad | May, 2024 | Medium
19
Ravi Patel
https://medium.com/@amirhosseineidy/how-to-join-master-node-or-control-plane-to-kubernetes-cluster-e16be68459bf 10/14
6/11/24, 10:21 PM How to join master node or control plane to Kubernetes cluster | by Amir Ad | May, 2024 | Medium
Subham Pradhan
4 1
Lists
https://medium.com/@amirhosseineidy/how-to-join-master-node-or-control-plane-to-kubernetes-cluster-e16be68459bf 11/14
6/11/24, 10:21 PM How to join master node or control plane to Kubernetes cluster | by Amir Ad | May, 2024 | Medium
Lubomir Tobek
50
24 1
Nidhi Ashtikar
Kubernetes Ingress
Project: Deploying a Web Application with Kubernetes Ingress
51
https://medium.com/@amirhosseineidy/how-to-join-master-node-or-control-plane-to-kubernetes-cluster-e16be68459bf 13/14
6/11/24, 10:21 PM How to join master node or control plane to Kubernetes cluster | by Amir Ad | May, 2024 | Medium
@Harsh
🚀
Setting Up a Kubernetes Multi-Node Cluster on AWS: A Step-by-Step
Guide
INTRODUCTION
9 1
https://medium.com/@amirhosseineidy/how-to-join-master-node-or-control-plane-to-kubernetes-cluster-e16be68459bf 14/14