$ -weight: 600;">sudo hostnamectl set-hostname k8s-master
-weight: 600;">sudo hostnamectl set-hostname k8s-worker1
-weight: 600;">sudo hostnamectl set-hostname k8s-master
-weight: 600;">sudo hostnamectl set-hostname k8s-worker1
-weight: 600;">sudo hostnamectl set-hostname k8s-master
-weight: 600;">sudo hostnamectl set-hostname k8s-worker1
192.168.1.10 k8s-master
192.168.1.11 k8s-worker1
192.168.1.12 k8s-worker2
192.168.1.10 k8s-master
192.168.1.11 k8s-worker1
192.168.1.12 k8s-worker2
192.168.1.10 k8s-master
192.168.1.11 k8s-worker1
192.168.1.12 k8s-worker2
-weight: 600;">sudo swapoff -a
-weight: 600;">sudo sed -i '/ swap / s/^/#/' /etc/fstab
-weight: 600;">sudo swapoff -a
-weight: 600;">sudo sed -i '/ swap / s/^/#/' /etc/fstab
-weight: 600;">sudo swapoff -a
-weight: 600;">sudo sed -i '/ swap / s/^/#/' /etc/fstab
-weight: 600;">sudo modprobe overlay
-weight: 600;">sudo modprobe br_netfilter -weight: 600;">sudo tee /etc/sysctl.d/k8s.conf <<EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
EOF
-weight: 600;">sudo sysctl --system
-weight: 600;">sudo modprobe overlay
-weight: 600;">sudo modprobe br_netfilter -weight: 600;">sudo tee /etc/sysctl.d/k8s.conf <<EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
EOF
-weight: 600;">sudo sysctl --system
-weight: 600;">sudo modprobe overlay
-weight: 600;">sudo modprobe br_netfilter -weight: 600;">sudo tee /etc/sysctl.d/k8s.conf <<EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
EOF
-weight: 600;">sudo sysctl --system
-weight: 600;">sudo -weight: 500;">apt-get -weight: 500;">update
-weight: 600;">sudo -weight: 500;">apt-get -weight: 500;">install -y containerd
-weight: 600;">sudo mkdir -p /etc/containerd
containerd config default | -weight: 600;">sudo tee /etc/containerd/config.toml
-weight: 600;">sudo -weight: 500;">apt-get -weight: 500;">update
-weight: 600;">sudo -weight: 500;">apt-get -weight: 500;">install -y containerd
-weight: 600;">sudo mkdir -p /etc/containerd
containerd config default | -weight: 600;">sudo tee /etc/containerd/config.toml
-weight: 600;">sudo -weight: 500;">apt-get -weight: 500;">update
-weight: 600;">sudo -weight: 500;">apt-get -weight: 500;">install -y containerd
-weight: 600;">sudo mkdir -p /etc/containerd
containerd config default | -weight: 600;">sudo tee /etc/containerd/config.toml
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options] SystemdCgroup = true
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options] SystemdCgroup = true
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options] SystemdCgroup = true
-weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">restart containerd
-weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">enable containerd
-weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">restart containerd
-weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">enable containerd
-weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">restart containerd
-weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">enable containerd
-weight: 600;">sudo -weight: 500;">apt-get -weight: 500;">update
-weight: 600;">sudo -weight: 500;">apt-get -weight: 500;">install -y -weight: 500;">apt-transport-https ca-certificates -weight: 500;">curl -weight: 600;">sudo -weight: 500;">curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://pkgs.k8s.io/core:/stable:/v1.33/deb/Release.key echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.33/deb/ /" | -weight: 600;">sudo tee /etc/-weight: 500;">apt/sources.list.d/kubernetes.list -weight: 600;">sudo -weight: 500;">apt-get -weight: 500;">update
-weight: 600;">sudo -weight: 500;">apt-get -weight: 500;">install -y kubelet=1.33.2-1.1 kubeadm=1.33.2-1.1 -weight: 500;">kubectl=1.33.2-1.1 -weight: 600;">sudo -weight: 500;">apt-mark hold kubelet kubeadm -weight: 500;">kubectl
-weight: 600;">sudo -weight: 500;">apt-get -weight: 500;">update
-weight: 600;">sudo -weight: 500;">apt-get -weight: 500;">install -y -weight: 500;">apt-transport-https ca-certificates -weight: 500;">curl -weight: 600;">sudo -weight: 500;">curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://pkgs.k8s.io/core:/stable:/v1.33/deb/Release.key echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.33/deb/ /" | -weight: 600;">sudo tee /etc/-weight: 500;">apt/sources.list.d/kubernetes.list -weight: 600;">sudo -weight: 500;">apt-get -weight: 500;">update
-weight: 600;">sudo -weight: 500;">apt-get -weight: 500;">install -y kubelet=1.33.2-1.1 kubeadm=1.33.2-1.1 -weight: 500;">kubectl=1.33.2-1.1 -weight: 600;">sudo -weight: 500;">apt-mark hold kubelet kubeadm -weight: 500;">kubectl
-weight: 600;">sudo -weight: 500;">apt-get -weight: 500;">update
-weight: 600;">sudo -weight: 500;">apt-get -weight: 500;">install -y -weight: 500;">apt-transport-https ca-certificates -weight: 500;">curl -weight: 600;">sudo -weight: 500;">curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://pkgs.k8s.io/core:/stable:/v1.33/deb/Release.key echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.33/deb/ /" | -weight: 600;">sudo tee /etc/-weight: 500;">apt/sources.list.d/kubernetes.list -weight: 600;">sudo -weight: 500;">apt-get -weight: 500;">update
-weight: 600;">sudo -weight: 500;">apt-get -weight: 500;">install -y kubelet=1.33.2-1.1 kubeadm=1.33.2-1.1 -weight: 500;">kubectl=1.33.2-1.1 -weight: 600;">sudo -weight: 500;">apt-mark hold kubelet kubeadm -weight: 500;">kubectl
-weight: 600;">sudo sysctl --system
-weight: 600;">sudo sysctl --system
-weight: 600;">sudo sysctl --system
-weight: 600;">sudo kubeadm init \ --pod-network-cidr=192.168.0.0/16 \ --cri-socket=unix:///run/containerd/containerd.sock
-weight: 600;">sudo kubeadm init \ --pod-network-cidr=192.168.0.0/16 \ --cri-socket=unix:///run/containerd/containerd.sock
-weight: 600;">sudo kubeadm init \ --pod-network-cidr=192.168.0.0/16 \ --cri-socket=unix:///run/containerd/containerd.sock
mkdir -p $HOME/.kube
-weight: 600;">sudo cp /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 /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 /etc/kubernetes/admin.conf $HOME/.kube/config
-weight: 600;">sudo chown $(id -u):$(id -g) $HOME/.kube/config
-weight: 600;">sudo kubeadm join <MASTER_IP>:6443 --token <TOKEN> --discovery-token-ca-cert-hash sha256:<HASH>
-weight: 600;">sudo kubeadm join <MASTER_IP>:6443 --token <TOKEN> --discovery-token-ca-cert-hash sha256:<HASH>
-weight: 600;">sudo kubeadm join <MASTER_IP>:6443 --token <TOKEN> --discovery-token-ca-cert-hash sha256:<HASH>
-weight: 500;">kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
-weight: 500;">kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
-weight: 500;">kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
-weight: 500;">kubectl get pods -n kube-system
-weight: 500;">kubectl get pods -n kube-system
-weight: 500;">kubectl get pods -n kube-system
-weight: 500;">kubectl get nodes
-weight: 500;">kubectl get nodes
-weight: 500;">kubectl get nodes
-weight: 500;">kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
-weight: 500;">kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
-weight: 500;">kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
-weight: 500;">kubectl top nodes
-weight: 500;">kubectl top pods
-weight: 500;">kubectl top nodes
-weight: 500;">kubectl top pods
-weight: 500;">kubectl top nodes
-weight: 500;">kubectl top pods
-weight: 500;">kubectl create deployment nginx --image=nginx
-weight: 500;">kubectl expose deployment nginx --port=80 --type=NodePort
-weight: 500;">kubectl create deployment nginx --image=nginx
-weight: 500;">kubectl expose deployment nginx --port=80 --type=NodePort
-weight: 500;">kubectl create deployment nginx --image=nginx
-weight: 500;">kubectl expose deployment nginx --port=80 --type=NodePort
-weight: 500;">kubectl get svc nginx
-weight: 500;">kubectl get svc nginx
-weight: 500;">kubectl get svc nginx
kubeadm token create --print-join-command
kubeadm token create --print-join-command
kubeadm token create --print-join-command - I made sure to have at least two servers. I needed one control plane node (some folks call this the master), and at least one worker. I wanted to be practical, so I used two VMs.
- I installed Ubuntu 22.04. Each VM got at least 2 vCPU and 2GB RAM for the master and 1 vCPU, 2GB RAM for the worker.
- I gave each machine a static private IP. I checked to be sure my cluster’s pod network range would not overlap with these IPs.
- I tested that all my nodes could “see” each other over the network across all needed Kubernetes ports.
- I set up firewalls and cloud security so Kubernetes traffic (like port 6443 for the API and node ports 30000-32767) would not get blocked. - Exact steps to set up -weight: 500;">kubectl for my own user
- A command that looks like kubeadm join ... for bringing worker nodes into the cluster - I make sure kubeadm, kubelet, and -weight: 500;">kubectl match in version on all nodes.
- I protect my environments by using secure SSH keys, updating firewalls, and locking down the admin.conf file.
- For backup, I regularly save the /etc/kubernetes directory, mainly admin.conf and the PKI folder.
- I always watch the health of my cluster using -weight: 500;">kubectl get pods -n kube-system and -weight: 500;">kubectl get nodes.
- I read the Kubernetes docs before doing upgrades or changes to make sure I avoid problems.
- If I want to manage the cluster from my laptop, I copy the admin.conf to my ~/.kube/config directory.