googlekubernetes-sandbox

Add nodes to the cluster

If you have two Bitnami Kubernetes Sandbox Stack instances (each with their own Kubernetes cluster), you can create a cluster with them. In order to do so, one of the instances will be the master and the other will be the worker (you can freely chose which one is the master). This worker node will join the master node’s cluster.

Get the master node token

  • Execute the following command on the master node:

    $ kubeadm token list
    
  • Write down the token listed. It will be denoted as CLUSTER_TOKEN. Get the master node’s private IP address:

    $ ifconfig
    
  • Write down the IP address. It will be denoted as MASTER_IP.

Join the worker node to the master

  • Execute the following commands to tear down the worker’s cluster.

    $ kubeadm reset
    $ sudo rm /etc/kubernetes -r
    
  • Execute this command to join the master node’s cluster. Replace the CLUSTER_TOKEN and MASTER_IP placeholders:

    $ kubeadm join --token=CLUSTER_TOKEN MASTER_IP:6443
    
  • After this command, the following command (in the master node) will show two nodes.

    $ kubectl get nodes
    
    NAME       STATUS    AGE       VERSION
    node1      Ready     1d        v1.7.5
    node2      Ready     1d        v1.7.5
    
Last modification September 4, 2018