Kubeadm v1.32 Deployment

2 min read
Table of contents

In this article I will show you how to deploy Kubernetes cluster with kubeadm. Kubeadm is a tool built as best-practice "fast paths" for creating Kubernetes clusters. Kubeadm performs the actions necessary to get a minimum viable cluster up and running. It gives you maximum control and customization but requires more manual configuration for production features like certificate management and upgrades.
So, let's get started…
Environment
Hostname | at-kubeadm |
Operating System | Ubuntu 22.04 (Jammy) |
vCPU | 4 |
Memory | 8 GB |
Disk | 60 GB |
Network | 172.20.20.75 |
Kubeadm v1.32 Deployment
- Mapping hosts
nano /etc/hosts
---
172.20.20.75 at-kubeadm kubeadm.at.lab
- Update and upgrade packages
apt-get update -y && apt-get upgrade -y
- Disable swap
systemctl disable --now swap.target
swapoff -a
- Enable containerd modules
cat <<EOF | sudo tee /etc/modules-load.d/containerd.conf
overlay
br_netfilter
EOF
modprobe overlay
modprobe br_netfilter
- Configure kernel settings
cat <<EOF | sudo tee /etc/sysctl.d/99-kubernetes-cri.conf
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-ip6tables = 1
EOF
sysctl --system
- Install containerd as container runtime
apt install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt update
apt install containerd.io
- Configure cgroup on containerd
containerd config default | tee /etc/containerd/config.toml >/dev/null 2>&1
sed -i 's/SystemdCgroup \= false/SystemdCgroup \= true/g' /etc/containerd/config.toml
systemctl restart containerd
systemctl enable containerd
- Install kube tools
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.32/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.32/deb/ /' | tee /etc/apt/sources.list.d/kubernetes.list
apt update
apt install -y kubelet=1.32.7-1.1 kubeadm=1.32.7-1.1 kubectl=1.32.7-1.1
apt-mark hold kubelet kubeadm kubectl
- Bootstrap cluster
kubeadm init --pod-network-cidr 10.244.0.0/16 --control-plane-endpoint kubeadm.at.lab
- Delete control plane taint
kubectl taint nodes --all node-role.kubernetes.io/control-plane-
- Install cilium as pod network addons
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
helm repo add cilium https://helm.cilium.io/
helm repo update
helm repo list
helm search repo cilium/cilium --versions
cat<<EOF >> ~/.bashrc
export KUBECONFIG=/etc/kubernetes/admin.conf
EOF
source ~/.bashrc
helm install cilium cilium/cilium --version 1.18.0 --namespace kube-system --set operator.replicas=1
- Install ingress nginx as ingress controller
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
helm repo list
helm search repo ingress-nginx/ingress-nginx --versions
helm install ingress-nginx ingress-nginx/ingress-nginx --version 4.13.0 --set controller.service.externalIPs[0]=172.20.20.75 --namespace ingress-nginx --create-namespace
- Verification
kubectl config view
kubectl cluster-info
kubectl get nodes -o wide
kubectl get all -A
- Operational test
kubectl create deployment nginx-test --image=nginx --replicas=1
kubectl expose deployment nginx-test --port=80 --target-port=80
kubectl create ingress nginx-test-ingress --class=nginx --rule="nginx-test.at.lab/*=nginx-test:80"
nano /etc/hosts
---
172.20.20.75 nginx-test.at.lab
curl http://nginx-test.at.lab
Thank You.
0
Subscribe to my newsletter
Read articles from Muhammad Alfian Tirta Kusuma directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
