Kubeadm commands
28 commands in 4 groups: Install, Manage, Configure, List & Inspect. Click or tap any command to copy it. Official documentation: kubernetes.io.
Open in the interactive cheat sheet search, stars and every other section
Install
Install kubeadm, kubelet, and kubectl on each node. These steps are required before initializing or joining a cluster.
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.36/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
Add the Kubernetes apt repository signing key
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.36/deb/ /" | tee /etc/apt/sources.list.d/kubernetes.list
Add the Kubernetes apt repository
systemctl enable --now kubelet
Enable and start the kubelet service
apt-mark hold kubelet kubeadm kubectl
Prevent automatic upgrades of Kubernetes packages
apt-get update && apt-get install -y apt-transport-https ca-certificates curl gpg
Install prerequisites on Debian/Ubuntu
apt-get update && apt-get install -y kubelet kubeadm kubectl
Install kubelet, kubeadm, and kubectl
Manage
Initialize the control plane, join worker nodes, tear down clusters, and manage the upgrade lifecycle.
kubeadm init --control-plane-endpoint=<endpoint>
Initialize with a shared load-balancer endpoint (HA)
kubeadm init --cri-socket unix:///var/run/containerd/containerd.sock
Initialize with a specific CRI socket
kubeadm init --kubernetes-version=<version>
Initialize with a specific Kubernetes version
kubeadm init --pod-network-cidr=<cidr>
Initialize the control plane with a pod network CIDR
kubeadm join <control-plane-endpoint> --token <token> --discovery-token-ca-cert-hash sha256:<hash>
Join a worker node to the cluster
kubeadm join <control-plane-endpoint> --token <token> --discovery-token-ca-cert-hash sha256:<hash> --control-plane --certificate-key <key>
Join a secondary control plane node (HA)
kubeadm reset
Revert changes made by init or join on this node
kubeadm reset --force
Force reset without confirmation prompts
kubeadm token create --print-join-command
Generate a new join command for worker nodes
kubeadm upgrade apply v<version>
Upgrade the control plane to a new version
kubeadm upgrade node
Upgrade a worker or secondary control plane node
kubeadm upgrade plan
Check which versions are available to upgrade to
Configure
Upload configs, manage certificates, and generate kubeconfig files for cluster access.
mkdir -p $HOME/.kube && cp /etc/kubernetes/admin.conf $HOME/.kube/config && chown $(id -u):$(id -g) $HOME/.kube/config
Set up kubeconfig for the admin user after init
kubeadm certs certificate-key
Generate a certificate key for HA control plane join
kubeadm certs check-expiration
Check certificate expiration dates
kubeadm certs renew all
Renew all control plane certificates
kubeadm config print init-defaults
Print default init configuration YAML
kubeadm config print join-defaults
Print default join configuration YAML
kubeadm init phase upload-config kubeadm
Upload the kubeadm configuration to the cluster ConfigMap
kubeadm init phase upload-certs --upload-certs
Upload control plane certificates to the cluster for HA join
List & Inspect
View tokens, node statuses, and cluster configuration details.
kubectl get cm kubeadm-config -n kube-system -o yaml
View the kubeadm configuration stored in the cluster
kubeadm token list
List all bootstrap tokens