Use it to understand why Kubernetes keeps recreating or changing objects.
Controllers and Reconciliation
Controllers continuously compare desired state (spec) with actual state (status) and act to close the gap — the reconciliation loop behind Deployments, ReplicaSets, Services and operators.
1. Who owns it? kubectl get <obj> -o jsonpath='{.metadata.ownerReferences}'.
2. Change the owner, not the child.
3. Controller events and logs.
4. GitOps/Helm managing it?
5. Observe reconciliation.
spec stored → controller watches → acts → status updated → loop
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 How to verify Verify boundary
Read status.conditions and observedGeneration: if observedGeneration is lower than metadata.generation, the controller has not processed the latest change. Check controller logs for errors.
Step 2 Common failures Narrow the fault
Editing a ReplicaSet owned by a Deployment is reverted. A stuck finalizer keeps an object in Terminating. An operator that is not running leaves its custom resources unreconciled with no visible error on the object.
Changing a managed object by hand is undone by its controller — change the owner (Deployment, Helm release, GitOps source). Owner references show who manages an object.
kubectl get <obj> -o jsonpath='{.metadata.ownerReferences}'— first check for this topickubectl get pods -o wide— pods, status, node, IPkubectl describe pod <pod>— events and conditionskubectl logs <pod> [-c <c>] [--previous]— container logs (incl. previous crash)kubectl get events --sort-by=.lastTimestamp— recent cluster events
ReferenceWhat it is1 section · depth on demand
How it works
Controllers in kube-controller-manager (Deployment, ReplicaSet, Job, Node and others) and in operators watch resources through the API server. Each reconcile loop is level-based: it looks at current state, not at the event history, so it recovers after missed events.
ReferenceImportant terms & boundaries3 sections · depth on demand
How reconciliation shows up
Controllers watch objects and act until status matches spec: the Deployment controller creates ReplicaSets, the ReplicaSet controller creates Pods, the scheduler assigns nodes. kubectl describe events show each step; kubectl get <obj> -o yaml compares spec and status.conditions. If something "keeps coming back" after deletion, a controller or operator owns it (check ownerReferences).
In depth
A controller watches objects and repeatedly makes the actual state match spec. Reconciliation is level-triggered: it acts on the current state, not on the event that changed it, so a missed event is corrected on the next loop.
Ownership chain for a Deployment
Deployment → owns ReplicaSet (one per template revision) → owns Pods. Each child carries metadata.ownerReferences to its parent. Editing a child directly is overwritten on the next reconcile.
Reading progress from status
| Field | Tells you |
|---|---|
metadata.generation | Increments on every spec change |
status.observedGeneration | Last generation the controller processed |
status.conditions | Available, Progressing, ReplicaFailure … with reason and message |
observedGeneration < generation means the controller has not caught up — check that its controller is running.
Finalizers and stuck deletes
An object with metadata.finalizers is only marked for deletion (deletionTimestamp set) until the controller that owns the finalizer cleans up and removes it.
kubectl get ns stuck -o jsonpath='{.spec.finalizers}{.metadata.finalizers}'
kubectl api-resources --verbs=list --namespaced -o name | \
xargs -n1 kubectl get -n stuck --ignore-not-found --show-kind
Find and fix the controller (or leftover resources) that holds the finalizer; removing a finalizer by hand skips its cleanup and can leave cloud resources behind.
Garbage collection
Deleting an owner deletes its dependents in the background by default; --cascade=orphan keeps them.
Common mistakes
- Manual changes fighting controllers.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.