Pcornel
Browse topics
Options
Recent
Favorites
Containers · Technical reference

Controllers and Reconciliation

Direct answer

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.

When to use this

Use it to understand why Kubernetes keeps recreating or changing objects.

First 30 seconds

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.

Operational verification

spec stored → controller watches → acts → status updated → loop

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
Docker / containerd / Podman / Kubernetes / OCI-compatible platforms
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformDocker / containerd / Podman / Kubernetes / OCI-compatible platforms
Scope / prerequisiteUse it to understand why Kubernetes keeps recreating or changing objects.
What next?2 suggested next steps
Evidence0
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

2 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

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.

Key points

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.

Key checks
  • kubectl get <obj> -o jsonpath='{.metadata.ownerReferences}' — first check for this topic
  • kubectl get pods -o wide — pods, status, node, IP
  • kubectl describe pod <pod> — events and conditions
  • kubectl 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

FieldTells you
metadata.generationIncrements on every spec change
status.observedGenerationLast generation the controller processed
status.conditionsAvailable, 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.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Common mistakes

  • Manual changes fighting controllers.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Terminology layer

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.

Aliases that resolve here
controllers and reconciliationkubernetes controller reconcileownerReferences
Confirmation

Confirm action

Continue?