Skip to main content
Course/Cluster Ops/Bootstrapping a Cluster with kubeadm
1/55 hours
Cluster Ops

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.

intermediate5 hoursRead β†’ Lab β†’ Quiz β†’ Practice
🧠 Brain Warm-Up
🧠 Brain Warm-Up: Before Kubernetes existed, administrators had to manually generate TLS certificates for every control plane component, configure systemd units, and wire static files by hand. What would break first if the etcd CA and the apiserver CA were different root certificates? Think about it before reading below.

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 kubelet

Post-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 Ready

kubeadm vs. Manual Setup

AspectManualkubeadm
PKI generationopenssl commands by handAutomated with sane defaults
Static podsWrite YAML by handGenerated from version-aware templates
Kubelet configManual systemd unitWritten by kubeadm, restarted automatically
Upgrade pathFully manualkubeadm upgrade apply
Bootstrap tokensN/AAuto-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.