← All cheatsheets
$ kubeadm certs check-expirationBootstrap and upgrade clusters with kubeadm, manage certificates and nodes, and back up and restore etcd.
Bootstrap and join
kubeadm init --pod-network-cidr=10.244.0.0/16Create a control planekubeadm init --control-plane-endpoint "lb.example.com:6443" --upload-certsCreate an HA control plane behind a load balancerkubeadm token create --print-join-commandPrint a fresh worker join commandkubeadm resetUndo kubeadm changes on a nodeUpgrades and nodes
Upgrade one minor version at a time. Replace v1.x.y with your target version.
kubeadm upgrade planSee available upgradeskubeadm upgrade apply v1.x.yUpgrade the first control plane nodekubeadm upgrade nodeUpgrade other control plane and worker nodeskubectl drain node-1 --ignore-daemonsets --delete-emptydir-dataMove workloads off a nodekubectl uncordon node-1Allow scheduling againCertificates
kubeadm certs check-expirationShow when certs expirekubeadm certs renew allRenew all control plane certskubeadm kubeconfig user --client-name=janeCreate a kubeconfig for a useretcd backup and restore
The etcdctl commands need the TLS flags shown in the first row. Paths below are kubeadm defaults.
ETCDCTL_API=3 etcdctl --endpoints=https://127.0.0.1:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key snapshot save /backup/etcd.dbTake a snapshotetcdutl snapshot status /backup/etcd.db -w tableCheck the snapshotetcdutl snapshot restore /backup/etcd.db --data-dir /var/lib/etcd-restoreRestore to a new data diretcdctl endpoint health --clusterCheck member health (add TLS flags)etcdctl member list -w tableList members (add TLS flags)etcdctl endpoint status -w tableShow leader and DB size (add TLS flags)etcdctl defragReclaim space (add TLS flags)