Skip to content

Instantly share code, notes, and snippets.

@jeromy-vandusen-obs
Last active March 21, 2026 02:56
Show Gist options
  • Select an option

  • Save jeromy-vandusen-obs/cfc2a8a2b417bf757d5ba68ad33425fb to your computer and use it in GitHub Desktop.

Select an option

Save jeromy-vandusen-obs/cfc2a8a2b417bf757d5ba68ad33425fb to your computer and use it in GitHub Desktop.
Kubernetes Installation Cheat Sheet

Kubernetes Installation Cheat Sheet

Use these steps to install Kubernetes tools on the master and worker nodes.

$ curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
$ sudo vim /etc/apt/sources.list.d/kubernetes.list
> deb http://apt.kubernetes.io/ kubernetes-xenial main
$ sudo apt-get update
$ sudo apt-get install kubelet kubeadm kubectl
$ sudo apt-mark hold kubelet kubeadm kubectl
$ sudo swapoff -a

Initialize the cluster on the master

Use these steps on the master node only.

$ sudo su -
$ kubeadm init
$ exit

Modify user account on the master to allow kubeadm commands

Use these steps on the master node only.

$ mkdir -p $HOME/.kube
$ sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
$ sudo chown $(id -u):$(id -g) $HOME/.kube/config

Install a pod network add-on on the master

There are many pod network add-ons available. This step uses Calico v1.6. For other options, look here. Use these steps on the master node only.

$ kubectl apply -f https://docs.projectcalico.org/v2.6/getting-started/kubernetes/installation/hosted/kubeadm/1.6/calico.yaml

Connect a worker node to the cluster

The second command, which actually joins the cluster at a given IP address using a token and a certificate hash, is only an example. When you execute the above commands to create the cluster on the master, the output will provide you with the actual command that you'll need to use. Copy that command from the output on the master and paste it to the command line on each node.

Use these steps on the worker nodes only.

$ sudo su -
$ kubeadm join 192.168.0.1:6443 --token aaabbb.ccccddddeeeeffff --discovery-token-ca-cert-hash sha256:abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz01

Generate a new token on the master to connect workers to the cluster

The token is only valid for 24 hours. If you want to add a new node to the cluster after that period expires, you'll need to generate a new token on the master.

Use this step on the master node only.

$ kubeadm token generate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment