# Disable swap immediately
-weight: 600;">sudo swapoff -a # Comment out the swap entry in /etc/fstab to persist across reboots
-weight: 600;">sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
# Disable swap immediately
-weight: 600;">sudo swapoff -a # Comment out the swap entry in /etc/fstab to persist across reboots
-weight: 600;">sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
# Disable swap immediately
-weight: 600;">sudo swapoff -a # Comment out the swap entry in /etc/fstab to persist across reboots
-weight: 600;">sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
# Create the configuration file for containerd modules
cat <<EOF | -weight: 600;">sudo tee /etc/modules-load.d/k8s.conf
overlay
br_netfilter
EOF -weight: 600;">sudo modprobe overlay
-weight: 600;">sudo modprobe br_netfilter # Configure sysctl parameters for Kubernetes networking
cat <<EOF | -weight: 600;">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 sysctl params without rebooting
-weight: 600;">sudo sysctl --system
# Create the configuration file for containerd modules
cat <<EOF | -weight: 600;">sudo tee /etc/modules-load.d/k8s.conf
overlay
br_netfilter
EOF -weight: 600;">sudo modprobe overlay
-weight: 600;">sudo modprobe br_netfilter # Configure sysctl parameters for Kubernetes networking
cat <<EOF | -weight: 600;">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 sysctl params without rebooting
-weight: 600;">sudo sysctl --system
# Create the configuration file for containerd modules
cat <<EOF | -weight: 600;">sudo tee /etc/modules-load.d/k8s.conf
overlay
br_netfilter
EOF -weight: 600;">sudo modprobe overlay
-weight: 600;">sudo modprobe br_netfilter # Configure sysctl parameters for Kubernetes networking
cat <<EOF | -weight: 600;">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 sysctl params without rebooting
-weight: 600;">sudo sysctl --system
# Install dependencies and containerd
-weight: 600;">sudo -weight: 500;">apt-get -weight: 500;">update
-weight: 600;">sudo -weight: 500;">apt-get -weight: 500;">install -y ca-certificates -weight: 500;">curl gnupg containerd # Generate the default configuration file
-weight: 600;">sudo mkdir -p /etc/containerd
containerd config default | -weight: 600;">sudo tee /etc/containerd/config.toml > /dev/null # Configure containerd to use the systemd cgroup driver
-weight: 600;">sudo sed -i 's/SystemdCgroup \= false/SystemdCgroup \= true/g' /etc/containerd/config.toml # Restart and -weight: 500;">enable containerd
-weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">restart containerd
-weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">enable containerd
# Install dependencies and containerd
-weight: 600;">sudo -weight: 500;">apt-get -weight: 500;">update
-weight: 600;">sudo -weight: 500;">apt-get -weight: 500;">install -y ca-certificates -weight: 500;">curl gnupg containerd # Generate the default configuration file
-weight: 600;">sudo mkdir -p /etc/containerd
containerd config default | -weight: 600;">sudo tee /etc/containerd/config.toml > /dev/null # Configure containerd to use the systemd cgroup driver
-weight: 600;">sudo sed -i 's/SystemdCgroup \= false/SystemdCgroup \= true/g' /etc/containerd/config.toml # Restart and -weight: 500;">enable containerd
-weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">restart containerd
-weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">enable containerd
# Install dependencies and containerd
-weight: 600;">sudo -weight: 500;">apt-get -weight: 500;">update
-weight: 600;">sudo -weight: 500;">apt-get -weight: 500;">install -y ca-certificates -weight: 500;">curl gnupg containerd # Generate the default configuration file
-weight: 600;">sudo mkdir -p /etc/containerd
containerd config default | -weight: 600;">sudo tee /etc/containerd/config.toml > /dev/null # Configure containerd to use the systemd cgroup driver
-weight: 600;">sudo sed -i 's/SystemdCgroup \= false/SystemdCgroup \= true/g' /etc/containerd/config.toml # Restart and -weight: 500;">enable containerd
-weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">restart containerd
-weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">enable containerd
# Download the public signing key for the Kubernetes package repositories
-weight: 500;">curl -fsSL [https://pkgs.k8s.io/core:/stable:/v1.29/deb/Release.key](https://pkgs.k8s.io/core:/stable:/v1.29/deb/Release.key) | -weight: 600;">sudo gpg --dearmor -o /etc/-weight: 500;">apt/keyrings/kubernetes--weight: 500;">apt-keyring.gpg # Add the appropriate Kubernetes -weight: 500;">apt repository
echo 'deb [signed-by=/etc/-weight: 500;">apt/keyrings/kubernetes--weight: 500;">apt-keyring.gpg] [https://pkgs.k8s.io/core:/stable:/v1.29/deb/](https://pkgs.k8s.io/core:/stable:/v1.29/deb/) /' | -weight: 600;">sudo tee /etc/-weight: 500;">apt/sources.list.d/kubernetes.list # Update -weight: 500;">apt package index and -weight: 500;">install components
-weight: 600;">sudo -weight: 500;">apt-get -weight: 500;">update
-weight: 600;">sudo -weight: 500;">apt-get -weight: 500;">install -y kubelet kubeadm -weight: 500;">kubectl # Pin the versions so they are not automatically upgraded
-weight: 600;">sudo -weight: 500;">apt-mark hold kubelet kubeadm -weight: 500;">kubectl
# Download the public signing key for the Kubernetes package repositories
-weight: 500;">curl -fsSL [https://pkgs.k8s.io/core:/stable:/v1.29/deb/Release.key](https://pkgs.k8s.io/core:/stable:/v1.29/deb/Release.key) | -weight: 600;">sudo gpg --dearmor -o /etc/-weight: 500;">apt/keyrings/kubernetes--weight: 500;">apt-keyring.gpg # Add the appropriate Kubernetes -weight: 500;">apt repository
echo 'deb [signed-by=/etc/-weight: 500;">apt/keyrings/kubernetes--weight: 500;">apt-keyring.gpg] [https://pkgs.k8s.io/core:/stable:/v1.29/deb/](https://pkgs.k8s.io/core:/stable:/v1.29/deb/) /' | -weight: 600;">sudo tee /etc/-weight: 500;">apt/sources.list.d/kubernetes.list # Update -weight: 500;">apt package index and -weight: 500;">install components
-weight: 600;">sudo -weight: 500;">apt-get -weight: 500;">update
-weight: 600;">sudo -weight: 500;">apt-get -weight: 500;">install -y kubelet kubeadm -weight: 500;">kubectl # Pin the versions so they are not automatically upgraded
-weight: 600;">sudo -weight: 500;">apt-mark hold kubelet kubeadm -weight: 500;">kubectl
# Download the public signing key for the Kubernetes package repositories
-weight: 500;">curl -fsSL [https://pkgs.k8s.io/core:/stable:/v1.29/deb/Release.key](https://pkgs.k8s.io/core:/stable:/v1.29/deb/Release.key) | -weight: 600;">sudo gpg --dearmor -o /etc/-weight: 500;">apt/keyrings/kubernetes--weight: 500;">apt-keyring.gpg # Add the appropriate Kubernetes -weight: 500;">apt repository
echo 'deb [signed-by=/etc/-weight: 500;">apt/keyrings/kubernetes--weight: 500;">apt-keyring.gpg] [https://pkgs.k8s.io/core:/stable:/v1.29/deb/](https://pkgs.k8s.io/core:/stable:/v1.29/deb/) /' | -weight: 600;">sudo tee /etc/-weight: 500;">apt/sources.list.d/kubernetes.list # Update -weight: 500;">apt package index and -weight: 500;">install components
-weight: 600;">sudo -weight: 500;">apt-get -weight: 500;">update
-weight: 600;">sudo -weight: 500;">apt-get -weight: 500;">install -y kubelet kubeadm -weight: 500;">kubectl # Pin the versions so they are not automatically upgraded
-weight: 600;">sudo -weight: 500;">apt-mark hold kubelet kubeadm -weight: 500;">kubectl
-weight: 600;">sudo kubeadm init \ --control-plane-endpoint="<LOAD_BALANCER_IP>:6443" \ --upload-certs \ --pod-network-cidr=192.168.0.0/16
-weight: 600;">sudo kubeadm init \ --control-plane-endpoint="<LOAD_BALANCER_IP>:6443" \ --upload-certs \ --pod-network-cidr=192.168.0.0/16
-weight: 600;">sudo kubeadm init \ --control-plane-endpoint="<LOAD_BALANCER_IP>:6443" \ --upload-certs \ --pod-network-cidr=192.168.0.0/16
mkdir -p $HOME/.kube
-weight: 600;">sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
-weight: 600;">sudo chown $(id -u):$(id -g) $HOME/.kube/config
mkdir -p $HOME/.kube
-weight: 600;">sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
-weight: 600;">sudo chown $(id -u):$(id -g) $HOME/.kube/config
mkdir -p $HOME/.kube
-weight: 600;">sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
-weight: 600;">sudo chown $(id -u):$(id -g) $HOME/.kube/config
# Install the Tigera operator
-weight: 500;">kubectl create -f [https://raw.githubusercontent.com/projectcalico/calico/v3.27.0/manifests/tigera-operator.yaml](https://raw.githubusercontent.com/projectcalico/calico/v3.27.0/manifests/tigera-operator.yaml) # Install the custom resources (this deploys Calico within the cluster)
-weight: 500;">kubectl create -f [https://raw.githubusercontent.com/projectcalico/calico/v3.27.0/manifests/custom-resources.yaml](https://raw.githubusercontent.com/projectcalico/calico/v3.27.0/manifests/custom-resources.yaml)
# Install the Tigera operator
-weight: 500;">kubectl create -f [https://raw.githubusercontent.com/projectcalico/calico/v3.27.0/manifests/tigera-operator.yaml](https://raw.githubusercontent.com/projectcalico/calico/v3.27.0/manifests/tigera-operator.yaml) # Install the custom resources (this deploys Calico within the cluster)
-weight: 500;">kubectl create -f [https://raw.githubusercontent.com/projectcalico/calico/v3.27.0/manifests/custom-resources.yaml](https://raw.githubusercontent.com/projectcalico/calico/v3.27.0/manifests/custom-resources.yaml)
# Install the Tigera operator
-weight: 500;">kubectl create -f [https://raw.githubusercontent.com/projectcalico/calico/v3.27.0/manifests/tigera-operator.yaml](https://raw.githubusercontent.com/projectcalico/calico/v3.27.0/manifests/tigera-operator.yaml) # Install the custom resources (this deploys Calico within the cluster)
-weight: 500;">kubectl create -f [https://raw.githubusercontent.com/projectcalico/calico/v3.27.0/manifests/custom-resources.yaml](https://raw.githubusercontent.com/projectcalico/calico/v3.27.0/manifests/custom-resources.yaml)
-weight: 500;">kubectl apply -f [https://raw.githubusercontent.com/metallb/metallb/v0.14.3/config/manifests/metallb-native.yaml](https://raw.githubusercontent.com/metallb/metallb/v0.14.3/config/manifests/metallb-native.yaml)
-weight: 500;">kubectl apply -f [https://raw.githubusercontent.com/metallb/metallb/v0.14.3/config/manifests/metallb-native.yaml](https://raw.githubusercontent.com/metallb/metallb/v0.14.3/config/manifests/metallb-native.yaml)
-weight: 500;">kubectl apply -f [https://raw.githubusercontent.com/metallb/metallb/v0.14.3/config/manifests/metallb-native.yaml](https://raw.githubusercontent.com/metallb/metallb/v0.14.3/config/manifests/metallb-native.yaml)
# metallb-config.yaml
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata: name: production-ip-pool namespace: metallb-system
spec: addresses: - 192.168.1.240-192.168.1.250 # Replace with your available IPs
---
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata: name: production-l2-advertisement namespace: metallb-system
spec: ipAddressPools: - production-ip-pool
# metallb-config.yaml
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata: name: production-ip-pool namespace: metallb-system
spec: addresses: - 192.168.1.240-192.168.1.250 # Replace with your available IPs
---
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata: name: production-l2-advertisement namespace: metallb-system
spec: ipAddressPools: - production-ip-pool
# metallb-config.yaml
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata: name: production-ip-pool namespace: metallb-system
spec: addresses: - 192.168.1.240-192.168.1.250 # Replace with your available IPs
---
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata: name: production-l2-advertisement namespace: metallb-system
spec: ipAddressPools: - production-ip-pool
-weight: 500;">kubectl apply -f metallb-config.yaml
-weight: 500;">kubectl apply -f metallb-config.yaml
-weight: 500;">kubectl apply -f metallb-config.yaml - Prepare Nodes: Disable swap memory and load required kernel modules (overlay, br_netfilter) on all servers.
- Install Runtime: Configure containerd with the systemd cgroup driver.
- Bootstrap Cluster: Use kubeadm init with a highly available control-plane endpoint.
- Establish Networking: Deploy the Calico Container Network Interface (CNI) for pod-to-pod communication.
- Enable Ingress: Configure MetalLB to expose services to external networks, bridging the gap left by missing cloud-native load balancers. - Load Balancer / VIP: A pre-configured highly available IP (via HAProxy/Keepalived or kube-vip) pointing to your control plane nodes on port 6443.
- Control Plane Nodes: 3x Ubuntu 22.04 or 24.04 servers (Minimum 4 vCPU, 8GB RAM).
- Worker Nodes: 2+ Ubuntu 22.04 or 24.04 servers (Minimum 4 vCPU, 16GB RAM).
- Network: All nodes must communicate over a secure private network with static IPs.
- Access: Full root or -weight: 600;">sudo privileges on all machines. - For remaining Control Plane nodes: (The command will include --control-plane and a --certificate-key flag).
- For Worker nodes: (The standard join command with the discovery token).