Difficulty: beginner
Estimated Time: 10-15 minutes

In this hands-on scenario, you will learn the basic concepts of Kubernetes.

  • Interact with Kubernetes through using the command line tool kubectl
  • Create a single master node with kubeadm
  • Create a worker node and join the cluster
  • Install a Kubernetes dashboard

Note

To speed things up, this scenario will start with two Ubuntu machines provisioned and kubeadm and kubectl have already been installed. References links have been provided at the bottom of each section to provide further details.

Kubernetes 101

Step 1 of 7

Step 1 - Initialise master

The first stage of initialising the cluster is to launch the master node. The master is responsible for running the control plane components;

  • etcd (the cluster database)
  • the API server (which the kubectl CLI communicates with)
  • scheduler
  • controller-manager

Task

In this case we are using kubeadm which will create a minimum viable Kubernetes cluster that conforms to the Kubernetes Conformance tests.

kubeadm init --token=7kpa7x.aqxooruii28hg8yk --kubernetes-version $(kubeadm version -o short)

In order to automate this scenario, a pre-determined token is being used. However, on real machines, it's recommended to exclude the token causing kubeadm to generate one on your behalf. So, you would use something like below;

Example:

kubeadm init --apiserver-advertise-address=$(hostname -i)

Reference

https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/

Terminal Host 2