Custom Thumbnail 

drop img here or browse to upload

add answer
create album
  • feeling
  • traveling
  • watching
  • playing
  • listening
  • Happy
  • Loved
  • Sad
  • Very sad
  • Angry
  • Confused
  • Hot
  • Broken
  • expressionless
  • Cool
  • Funny
  • Tired
  • Lovely
  • Blessed
  • Shocked
  • Sleepy
  • Pretty
  • Bored
0%

How to Add a New Node to Kubespray Manased Production Ready Kubernetes Cluster

How to Add a New Node to Kubespray Manased Production Ready Kubernetes Cluster

I have a production ready kubernetes cluster managed by kubespray. Now I need to add additional node to the cluster. Here I am showing you how you can add a additional node to your cluster. Here my existing cluster - 

╰─ kubectl get nodes                                                                                                                                        
NAME    STATUS   ROLES                  AGE    VERSION
node1   Ready    control-plane,master   28d    v1.21.4
node2   Ready    control-plane,master   28d    v1.21.4
node3   Ready    <none>                 28d    v1.21.4

 

Now I want to add a new node4 to the cluster. First of all I need to edit the existing ansiable host file  which is inventory/mycluster/hosts.yaml

# file path - inventory/mycluster/hosts.yaml
all:
  hosts:
    node1:
      ansible_host: 10.180.63.193
      ip: 10.180.63.193
      access_ip: 10.180.63.193
    node2:
      ansible_host: 10.180.63.151
      ip: 10.180.63.151
      access_ip: 10.180.63.151
    node3:
      ansible_host: 10.180.63.30
      ip: 10.180.63.30
      access_ip: 10.180.63.30
    node4:
      ansible_host: 10.180.63.160
      ip: 10.180.63.160
      access_ip: 10.180.63.160
  children:
    kube_control_plane:
      hosts:
        node1:
        node2:
    kube_node:
      hosts:
        node1:
        node2:
        node3:
        node4:
    etcd:
      hosts:
        node1:
        node2:
        node3:
    k8s_cluster:
      children:
        kube_control_plane:
        kube_node:
    calico_rr:
      hosts: {}

 

I added node4 information in the above hosts.yaml file. Here my node4 information -

#my node4 information 

    node4:
      ansible_host: 10.180.63.160
      ip: 10.180.63.160
      access_ip: 10.180.63.160

 

Now run the cluster.yml file to add the new node to the cluster.

ansible-playbook -i inventory/mycluster/hosts.yaml cluster.yml -u root -b -l node4

 

Where,

  • -i : inventory file to be used
  • cluster.yml : playbook to deploy a cluster
  • -u root : the user account which we have created on all nodes for password-less ssh access.
  • -b : enable become – sudo access is needed for installing packages, starting services, creating SSL certificates etc.

 

Wait to finish the process. 

All done! Now verify the newly added node4 to the cluster.

╰─ kubectl get nodes                                                                                                                                        
NAME    STATUS   ROLES                  AGE    VERSION
node1   Ready    control-plane,master   28d    v1.21.4
node2   Ready    control-plane,master   28d    v1.21.4
node3   Ready    <none>                 28d    v1.21.4
node4   Ready    <none>                 102s   v1.21.4

Now node4 is a part of your cluster.

Vika , Razu and
34 more liked this
    Back
    friends & family