Skip to content

Instantly share code, notes, and snippets.

@mrflobow
Last active March 12, 2023 09:16
Show Gist options
  • Save mrflobow/30a4cf43640d72eb441c4309850eff73 to your computer and use it in GitHub Desktop.
Save mrflobow/30a4cf43640d72eb441c4309850eff73 to your computer and use it in GitHub Desktop.
K8S Base Installation - Debian 11

This steps will be execute on the Master Node if not otherwise mentioned.

Pre-Steps

  1. Disable swap
sudo swapoff -a
  1. Comment swap line in /etc/fstab
  2. Follow Pre-Steps in https://kubernetes.io/docs/setup/production-environment/container-runtimes/

Container Runtime

  1. Install containerd manual https://github.com/containerd/containerd/blob/main/docs/getting-started.md https://kubernetes.io/docs/setup/production-environment/container-runtimes/#containerd
  2. Create default config
sudo mkdir /etc/containerd
sudo su - 
containerd config default > /etc/containerd/config.toml
exit
sudo systemctl restart containerd
  1. Update config
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
  ...
  [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
    SystemdCgroup = true
  1. Restart containerd
sudo systemctl restart containerd

Install Kubernetes

  1. Create missing directory
sudo mkdir /etc/apt/keyrings
  1. Follow https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/

By default kubernetes 1.26+ will use systemd as cgroup

  1. Save the join command statement securley. You will need it later for joining the Worker Nodes

Join Nodes ( Worker Nodes)

Repeat all steps above for the nodes except the "kubadm init". Once you have finished the steps run the join command.

kubeadm join <masterip>:6443 --token <token> --discovery-token-ca-cert-hash <discoverytoken>

If you secured the join command in step Install Kubernetes all fields are prefilled.

Add Network

In this instruction we are using calico. Run the following commands on master:

curl https://raw.githubusercontent.com/projectcalico/calico/v3.25.0/manifests/calico.yaml -O
kubectl apply -f calico.yaml

Ref. (https://docs.tigera.io/calico/3.25/getting-started/kubernetes/self-managed-onprem/onpremises) After a minute verify that your cluster is up and running.

kubectl get nodes

Output:
NAME      STATUS   ROLES           AGE   VERSION
kmaster   Ready    control-plane   20h   v1.26.2
knode01   Ready    <none>          20h   v1.26.2
knode02   Ready    <none>          20h   v1.26.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment