LAB01: K8s Installation

LAB01: Kubernetes Installation & Configuration

Demo: Prepare VMs

Start 3 Ubuntu VMs, 2cpu, 4gb RAM, 20-30GB.

  1. Set hostname and also map in /etc/hosts

  • demo-k8s-m1

  • demo-k8s-w1

  • demo-k8s-w2

Full Install Steps

sudo swapoff -a

sudo modprobe overlay
sudo modprobe br_netfilter

Check 6443 port is open in the firewall,

Connection refused in the output means no firewall is blocking this port Else it will timed out which means firewall is blocking

nc 127.0.0.1 6443 -v
sudo tee /etc/sysctl.d/kubernetes.conf<<EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
EOF

Add Docker's official GPG key:

Install containerd

Edit so it looks like this

Install Kubernetes Binaries - Kubeadm, kubelet, kubectl

Start Master Node! Depends on the CNI Deployed Calico is Most Common

Initialize cluster

or

This command will print node join command like below, keep it for later use while we join the worker node:

After control-plane initialization, export configuration.

apply labels [optional]

Untill now you should see nodes is NotReady State.

To be fully ready, kubernetes need pod networking ready. We use calico CNI to enable pod networking.

Later apply calico configuration

https://docs.tigera.io/calico/latest/getting-started/kubernetes/quickstart

Copy discovery token joining information, the pods will use their local netork. Worker nodes need same installation but don't "have" to have kubectl (but it is nice to run it from anywhere)

Joining worker nodes, run the join command copied at kubernetes initialization phase e.g.

Check pods for master node, and validate issues, but remember this may take some time (10m) Nodes will add as the configurtarion takes effect.

Check logs for issues.

You will know the master node is ready to join worker nodes by running the following, and see "ready"

Optional

  1. crictl

  1. etcdctl

Troubleshooting

References

Last updated