$linuxjunkies
>

kubeadm(1)

Bootstrap a Kubernetes cluster with kubeadm, a tool for initializing and managing cluster control planes and worker nodes.

UbuntuDebianFedoraArch

Synopsis

kubeadm [command] [flags]

Description

kubeadm is a command-line tool that handles the tedious setup work required to get a Kubernetes cluster running. It performs the essential steps to bootstrap a cluster: installing system packages, configuring container runtimes, initializing the control plane, and joining worker nodes to the cluster.

kubeadm works by wrapping low-level steps into higher-level commands that abstract away the complexity of certificate generation, kubeconfig creation, and component deployment. It is designed to be simple, portable, and extensible across different environments.

Common options

FlagWhat it does
--config=stringPath to a kubeadm configuration file; configuration specified here overrides command-line flags
--kubernetes-version=stringThe Kubernetes version for the control plane; defaults to the version of kubeadm binary
--apiserver-advertise-address=stringThe IP address the API server will advertise (must be reachable by worker nodes)
--pod-network-cidr=stringSpecify the range of IP addresses for the pod network; required for some network plugins
--service-cidr=stringUse alternative range of IP address for service VIPs; default is 10.96.0.0/12
--token=stringThe token to use for establishing bidirectional trust between nodes and the control plane
--token-ttl=durationThe duration before the token is automatically deleted; 0 means it never expires
--discovery-token-ca-cert-hash=stringFor kubeadm join: hash of the cluster's root CA certificate
--control-planeMark this node as a control plane component during join operation
--dry-runRun through the motions, collecting errors, without actually modifying the system
-v, --verbose=intSet the verbosity level; higher numbers produce more detailed output

Examples

Initialize a control plane on the current machine with specific advertise IP and pod network CIDR for Flannel CNI

kubeadm init --apiserver-advertise-address=192.168.1.100 --pod-network-cidr=10.244.0.0/16

Generate a new bootstrap token and print the complete join command with discovery token CA cert hash

kubeadm token create --print-join-command

Join a worker node to an existing cluster using the control plane IP, token, and CA cert hash

kubeadm join 192.168.1.100:6443 --token abc123.def456token --discovery-token-ca-cert-hash sha256:abc123def456

Check which versions you can upgrade to and what important upgrades are available

kubeadm upgrade plan

Upgrade the control plane components on this node to v1.28.0

kubeadm upgrade apply v1.28.0

Perform a dry run of cluster initialization using a config file to validate without making changes

kubeadm init --config=/etc/kubernetes/kubeadm-config.yaml --dry-run

Undo changes made to this host by kubeadm init or kubeadm join; removes all Kubernetes files and certificates

kubeadm reset --force

Check the expiration dates of all certificates in the cluster

kubeadm certs check-expiration

Related commands