Bootstrapping a Cluster with kubeadm
Learn how kubeadm automates the complex PKI and static-pod setup required to stand up a production-grade control plane, then join worker nodes using bootstrap tokens.
kubeadm: Automated Cluster Bootstrap
kubeadm is the official Kubernetes cluster bootstrap tool. It handles the hard parts: generating a PKI from scratch, writing static pod manifests, and producing kubeconfig files so each control-plane component can authenticate to the API server.
The kubeadm init Workflow
kubeadm init runs through six well-defined phases. Each phase can be run individually with kubeadm init phase for debugging:
kubeadm init
β
ββ 1. Preflight Checks ββββ swap disabled? kernel params? required binaries?
β ports available? container runtime responding?
β
ββ 2. Certificates βββββββ generate /etc/kubernetes/pki/
β ca.crt, apiserver.crt, apiserver-etcd-client.crt,
β front-proxy-ca.crt, etcd/ca.crt, sa.key/sa.pub
β
ββ 3. Kubeconfigs ββββββββ admin.conf, controller-manager.conf,
β scheduler.conf, kubelet.conf
β
ββ 4. Control Plane ββββββ write static pod manifests to
β Static Pods /etc/kubernetes/manifests/
β kube-apiserver.yaml, kube-controller-manager.yaml,
β kube-scheduler.yaml, etcd.yaml
β (kubelet auto-starts them as "mirror pods")
β
ββ 5. Bootstrap Token ββββ generate short-lived token (format: abcdef.0123456789abcdef)
β used by workers to authenticate during join
β
ββ 6. Kubelet Config βββββ write /var/lib/kubelet/config.yaml and
/etc/kubernetes/kubelet.conf
then restart kubeletPost-init: CNI Plugin
After init, the control plane is running but the CoreDNS pods will remain Pending until a CNI plugin is installed. Without a CNI, there is no overlay network for pod-to-pod traffic across nodes.
Without CNI: node-1 Pod ββXβββΆ node-2 Pod (no route) With Flannel (VXLAN): node-1 Pod βββΆ flannel0 βββΆ VXLAN encap βββΆ eth0 βββΆ node-2 eth0 βββΆ VXLAN decap βββΆ flannel0 βββΆ node-2 Pod
Worker Join Flow
The worker node uses the bootstrap token to authenticate a one-time TLS handshake:
Worker Node
β
ββ kubeadm join <control-plane-ip>:6443
β --token <bootstrap-token>
β --discovery-token-ca-cert-hash sha256:<hash>
β
ββ Contacts API server with token βββΆ API server validates token
ββ Downloads cluster CA cert βββΆ verifies against provided hash
ββ Generates kubelet client cert (TLS bootstrap) βββΆ signed by cluster CA
ββ kubelet starts with permanent certificate β node appears Readykubeadm vs. Manual Setup
| Aspect | Manual | kubeadm |
|---|---|---|
| PKI generation | openssl commands by hand | Automated with sane defaults |
| Static pods | Write YAML by hand | Generated from version-aware templates |
| Kubelet config | Manual systemd unit | Written by kubeadm, restarted automatically |
| Upgrade path | Fully manual | kubeadm upgrade apply |
| Bootstrap tokens | N/A | Auto-generated with 24h TTL |
kubeadm does not manage the underlying infrastructure (VMs, network) β it only configures the Kubernetes layer on top of an already-running OS.