Kubernetes interview question · Most asked

What is the reconciliation loop, and why is Kubernetes called declarative?

Summary

You declare the desired state of objects (three replicas of this image), and controllers run loops that observe the actual state, compare it with the desired state, and act to close the gap. You do not issue step-by-step commands; you change the desired state and the system converges.

Longer Answer

A Deployment controller creates a ReplicaSet; the ReplicaSet controller creates or deletes pods until the count matches; the scheduler binds unscheduled pods to nodes; the kubelet starts their containers. If a node dies, the pods disappear and the ReplicaSet controller creates replacements, with no human involved.

Consequences: operations should be idempotent and retried; kubectl apply of manifests from Git (GitOps) fits naturally; and manual kubectl edit changes drift from the source of truth and get overwritten. Operators extend the same pattern to your own resources.

Key Points

  • Desired state stored in the API.
  • Controllers observe, diff, act, repeat.
  • Self-healing comes from reconciliation.
  • Operators apply the pattern to custom resources.

More most-asked Kubernetes questions

← All Kubernetes questions