Lab 2.3 - Setup the Nodes

Once the master is setup and running, we need to join our nodes to the cluster.

Important

The following commands need to be run on the worker nodes only unless otherwise specified.

  1. To join the master we need to run the command highlighted during the master initialization. You’ll need to use the command saved to notepad in an earlier step.

    Warning

    • This following is just an example!! DO not cut/paste the one below. You should have saved this command after successfully initializing the master in the previous lab. Scroll up in your CLI history to find the hash your kube-master1 generated to add nodes.
    • This command needs to be run on node1 and node2 only!

    Hint

    If you missed the step to save the “kubeadm join…” command from the previous lab, run the following and use the output to join your nodes to the cluster.

    kubeadm token create --print-join-command
    

    Note

    You may need to add the following switch to the join command below on newer versions of kubernetes.

    --discovery-token-unsafe-skip-ca-verification
    
    kubeadm join 10.1.1.7:6443 --token 12rmdx.z0cbklfaoixhhdfj --discovery-token-ca-cert-hash sha256:c624989e418d92b8040a1609e493c009df5721f4392e90ac6b066c304cebe673
    

    The output should be similar to this:

    ../../_images/cluster-setup-guide-node-setup-join-master.png
  2. To verify the nodes have joined the cluster, run the following command on the kube-master1:

    kubectl get nodes
    

    You should see your cluster (ie master + nodes)

    ../../_images/cluster-setup-guide-node-setup-check-nodes.png
  3. Verify all the services are started as expected (run on the kube-master1) Don’t worry about last 5 characters matching on most services, as they are randomly generated:

    kubectl get pods --all-namespaces
    
    ../../_images/cluster-setup-guide-node-setup-check-services.png

Attention

CONGRATUATIONS! You just did the hardest part of todays lab - building a Kubernetes cluster. While we didn’t cover each step in great detail, due to time of other labs we need to complete today, this is one path to the overall steps to build your own cluster with a few linux boxes in your own lab. All this content is publicly online/available at clouddocs.f5.com.