Object Specifications and Status
What You'll Learn
You'll learn how Kubernetes uses two key fields—spec and status—to manage the difference between what you want and what actually exists in your cluster.
The Desired State vs Observed State Model
Every Kubernetes object follows a simple but powerful pattern: you tell the cluster what you want (spec), and Kubernetes reports back what it actually sees (status).
The Spec Field
The spec (specification) describes your desired state. When you create or update a Kubernetes object, you define what you want in the spec field. For example, you might specify that you want 3 replicas of a pod running, using a specific container image.
Think of spec as your order at a restaurant—it's what you're asking for.
The Status Field
The status describes the observed state—what Kubernetes actually sees in the cluster right now. Controllers continuously monitor this status and compare it to your spec. If there's a mismatch, they take action to reconcile the difference.
Status is like the waiter checking your table and reporting back: "You ordered three appetizers, but only two have been served so far."
How They Work Together
Kubernetes controllers constantly run this loop:
- Read the
spec(what you want) - Check the
status(what exists) - If they don't match, take corrective action
- Update the
statusto reflect the new reality
This reconciliation loop is the heart of Kubernetes' self-healing capabilities. You don't imperatively command Kubernetes to "start three pods"—you declaratively state "I want three pods," and the system works to make it happen.
Key Takeaway: The spec field defines your desired state, while status reflects the current observed state. Kubernetes controllers continuously reconcile these two to maintain your intended configuration.