You operate a fleet of Kubernetes clusters and the install process today is some mix of kubeadm init, Terraform, Ansible, and Wiki pages. The clusters drift. Upgrade is a project. Tearing one down and standing it back up is a half-day of choreography. Cluster API (CAPI) is the answer the community settled on — declarative Kubernetes resources that describe a cluster, with providers that materialise it on AWS, vSphere, OpenStack, Azure, GCP, bare metal. This article is the mental model and the operating procedure outline.
How to verify
A management cluster running CAPI exposes the core CRDs and a set of provider controllers:
kubectl get crd | grep cluster.x-k8s.io
kubectl get pods -n capi-system
kubectl get pods -n capi-kubeadm-control-plane-system
kubectl get pods -n capa-system # or capv, capo, capz depending on provider
Managed clusters show up as Cluster resources:
clusterctl describe cluster prod-eu
kubectl get clusters,machines,machinedeployments -A
A new cluster’s kubeconfig is retrievable from the management cluster:
clusterctl get kubeconfig prod-eu > prod-eu.kubeconfig
KUBECONFIG=prod-eu.kubeconfig kubectl get nodes
What’s happening
Cluster API splits cluster lifecycle into three layers, each backed by a Kubernetes CRD.
- Cluster is the top-level resource for a workload cluster. It references the infrastructure provider (e.g. AWSCluster) and the control plane provider.
- Infrastructure provider is the cloud-specific glue: AWSCluster owns the VPC, security groups, ELB for the API server; vSphereCluster owns the resource pool, network; MetalCluster owns the bare-metal inventory. Each provider has its own CRDs.
- Control plane provider owns the API server, scheduler, controller-manager. The most common is KubeadmControlPlane (KCP), which runs three to five control plane nodes via kubeadm, each on a Machine resource. There are alternatives — KubeOne control plane, K3s control plane, OCNE control plane — but KCP is what most teams pick.
The two are stitched by MachineDeployment (worker nodes) and MachineSet (immutable groups of workers), which mirror the Kubernetes Deployment/ReplicaSet pattern but for Machines. Each Machine is bound to an infrastructure-provider-specific resource (AWSMachine, VSphereMachine) and a Bootstrap resource (KubeadmConfig) that produces cloud-init data.
The Management Cluster is the place where CAPI itself runs. From there, you reconcile workload clusters — including the management cluster’s own self-hosted upgrade. You can self-manage (the mgmt cluster manages itself) or run a separate, smaller cluster dedicated to lifecycle.
Components inventory
- clusterctl — the CLI for installing CAPI into a cluster, listing providers, generating cluster manifests, and managing the bootstrap.
- CAPI core controllers — Cluster, MachineDeployment, MachineSet, MachineHealthCheck, KubeadmConfig.
- Infrastructure provider controllers — one per cloud or platform.
- Bootstrap provider controllers — usually
kubeadm, which produces the cloud-init that turns a fresh VM into a kubelet that joins the cluster. - Control plane provider controllers — usually
kubeadmcontrolplane, which owns the etcd quorum and API server pods.
What the resources look like
A full cluster spec is typically four to six YAML files. The shape (simplified):
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: prod-eu
spec:
clusterNetwork:
services: { cidrBlocks: [10.128.0.0/12] }
pods: { cidrBlocks: [192.168.0.0/16] }
infrastructureRef:
kind: AWSCluster
name: prod-eu
controlPlaneRef:
kind: KubeadmControlPlane
name: prod-eu-control-plane
---
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlane
metadata:
name: prod-eu-control-plane
spec:
replicas: 3
version: v1.31.4
machineTemplate:
infrastructureRef:
kind: AWSMachineTemplate
name: prod-eu-control-plane
kubeadmConfigSpec:
clusterConfiguration:
apiServer:
extraArgs:
audit-log-maxage: "30"
audit-log-maxbackup: "10"
audit-log-maxsize: "100"
The version field is the cluster’s Kubernetes version. Bumping it triggers a control-plane rolling upgrade managed by KCP — replicas are replaced one at a time, etcd quorum preserved.
When Cluster API fits
- You manage more than three clusters and the install scripts no longer fit your head.
- You want cluster lifecycle to be Git-driven and auditable — clusters in Git, reconciliation in CAPI.
- Self-service: developers can request a cluster by submitting a YAML.
- Mixed environments — AWS prod, on-prem dev, edge — that all need the same management model.
When something simpler fits
- You run one cluster and won’t add a second. CAPI is overhead for a single workload cluster.
- Your hyperscaler offers a strong managed control plane (EKS, GKE, AKS) and you’ll only manage nodes. In that case, the infra-provider’s node management features may suffice — see karpenter-autoscaling-aws-eks.
- You need extremely heterogeneous machine shapes per node and don’t want immutable Machines. CAPI’s machine-replace-on-change philosophy is the wrong tool.
Operational notes
- The management cluster is critical. If it dies, you can’t reconcile workload clusters. Treat it like any other production cluster — backups, monitoring, redundancy.
- clusterctl pivots are real. You can move CAPI state from one mgmt cluster to another via
clusterctl move. Test this before you need it. - MachineHealthCheck is essential. Without it, a sick node sits there. With it, CAPI deletes the Machine and the underlying VM is replaced. Configure node-conditions thoughtfully.
- etcd quorum during upgrade is the failure mode to know. KCP replaces control plane nodes one at a time and waits for etcd to be healthy before continuing. If the join is slow, the upgrade stalls. Pre-warm AMIs and validate cloud-init in dev.
- Versions across CAPI / provider / Kubernetes are coupled. Read the support matrix before bumping any of them. A management cluster on CAPI v1.6 cannot manage a workload cluster on Kubernetes 1.31 if the AWS provider is too old.
Stack Harbor adopts Cluster API for clients moving from heterogeneous install scripts to a single cluster-lifecycle CRD — the mgmt cluster design, the provider choice, the cluster catalogue in Git, and the upgrade rehearsals. See how we run multi-cluster fleets under clustered environments.