updated: 2023-06-03 Sat 00:00

setup kubernetes on Debian 12


Setup Debian 12 and configure sudo


install docker

setup docker in Debian add user permission.


install cri-dockerd

(needed for docker kubernetes integration)

Install cri-dockerd from https://github.com/Mirantis/cri-dockerd

for details - https://kubernetes.io/docs/setup/production-environment/container-runtimes/#docker


configure kernel modules

load necessary modules

sudo modprobe overlay
sudo modprobe br_netfilter

for persistent loading

cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
overlay
br_netfilter
EOF

kernel config

cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-iptables  = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward                 = 1
EOF

apply the changes without reboot

sudo sysctl --system

for details - https://kubernetes.io/docs/setup/production-environment/container-runtimes/


setup kubeadm kubectl

check - https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/ add repository

sudo apt-get install -y kubelet kubeadm kubectl


initialize kubeadm

my kubernetes controller's IP 192.168.0.220

So, initializing pod network with different series (10.182.0.0/16)

sudo kubeadm init --pod-network-cidr=10.182.0.0/16  \
      --cri-socket=unix:///var/run/cri-dockerd.sock \
      --apiserver-advertise-address=192.168.0.220

save the output specially for kubeadm join token.

copy kubectl config.

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

verify pods you will find coredns is not ready.

kubectl get pod -A


install Calico

We will use Calico for networking.

for details - https://docs.tigera.io/calico/latest/getting-started/kubernetes/self-managed-onprem/onpremises

Install Calico -> Manifest

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


check status

kubectl get pod -A

You will find all the pods are in running state.

Add worker nodes to this coordinator node using kubeadm join.


kubectl taint nodes

If you want to use coordinator node for pods (which is not enabled by default), without using any worker nodes, you may need

kubectl taint nodes --all node-role.kubernetes.io/control-plane-


Now, you can start deploying pods in your local kubernetes.