1. Install 3 Ubuntu Server 22.04 (fresh install) - 1 master node, 2 node worker
2. Update paket => sudo apt update && sudo apt upgrade -y (semua server)
3. Disable swap (semua server)
sudo swapoff -a
sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
4. Add Kernel Parameters (semua server)
sudo tee /etc/modules-load.d/containerd.conf <<EOF
overlay
br_netfilter
EOF
sudo modprobe overlay
sudo modprobe br_netfilter
5. Config kernel untuk kubernetes (semua server)
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
6. Reload config
sudo sysctl --system
7. Install Containerd Runtime (semua server)
sudo apt install -y curl gnupg2 software-properties-common apt-transport-https ca-certificates
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/docker.gpg
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
sudo apt install -y containerd.io
containerd config default | sudo tee /etc/containerd/config.toml >/dev/null 2>&1
sudo sed -i 's/SystemdCgroup \= false/SystemdCgroup \= true/g' /etc/containerd/config.toml
sudo systemctl restart containerd
sudo systemctl enable containerd
sudo systemctl status containerd
8. Tambah repo kubernetes dan install (semua server)
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key | sudo 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.28/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt update
sudo apt install -y kubeadm=1.28.1-1.1 kubelet=1.28.1-1.1 kubectl=1.28.1-1.1
9. Inisialisai kubenetes cluster (master node)
sudo kubeadm init
10. Setelah selesai inisialisasi simpan "kubeadm join..." untuk digunakan node worker nanti
11. Config kubectl (master node)
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
12. Cek cluster dan node status
kubectl get nodes
13. Tambahkan node worker untuk join ke cluster (node worker)
kubeadm join ... (note di step 10)
14. Install Kubernetes Network Plugin (master node)
kubectl apply -f https://raw.githubusercontent.com/projectcalico/calico/v3.25.0/manifests/calico.yaml
15. Verifikasi cluster (master node)
kubectl get pods -n kube-system
kubectl get nodes
16. Deploy test aplikasi di cluster (master node)
kubectl run nginx --image=nginx
kubectl get pods
DONE.