Images, containers, and reconciliation
Separate a packaged application from a running process and a desired cluster state.
What you’ll learn
- Distinguish image identity from container state
- Trace a controller recovering a missing replica
- Explain what a container restart does not preserve
Package and process are different objects
Imagine a small service that returns the current reading list. Its image contains the application and the user-space dependencies required by the chosen runtime. A container is a running instance created from that package, with isolation and configuration supplied by its environment. The image is not a running server, and rebuilding an image does not silently replace every existing process. Draw these as separate objects before reasoning about deployment. This prevents a surprisingly common misunderstanding during an upgrade.
Make an upgrade reproducible
Suppose the reading service uses image digest A on Monday and digest B on Tuesday. Recording the digest in a release record identifies the selected image content more precisely than recording a tag whose target can change. The application also needs configuration, permissions, network access, and possibly external storage. Reproducibility therefore means recording those inputs as well. Keep passwords out of image layers and source control. An image intended for public distribution should remain safe to inspect even when the service uses private credentials at runtime.
Trace the desired-state loop
Now ask Kubernetes to maintain three replicas. After one Pod disappears, the observed replica count is two while the desired count remains three. A controller notices the mismatch and takes action toward the requested state. This is reconciliation, rather than a single instruction that can never fail. Scheduling, image retrieval, permissions, or resource shortages can prevent the new Pod from becoming ready. Inspect status and events to distinguish a successful request to the API from a healthy running application.
Separate recovery from durable data
Restarting a process can restore service capacity, but it does not automatically preserve useful changes made only inside that process or its writable container filesystem. Store a learner account in a database with an explicit durability and backup plan; do not rely on a particular replica surviving. A persistent volume can have a different lifecycle from a container, but its access mode, failure behavior, and backup policy still need design. Persistence is a requirement to verify, not a property implied by the word container.
Learn the workflow in small steps
Start with one locally built image and one request that proves the service responds. Next change a visible version value and verify exactly which image runs. Only then add multiple replicas and deliberately remove one in a disposable environment. Record desired replicas, ready replicas, and observed errors before and after the experiment. This small trace teaches more than copying a large manifest whose fields are unexplained. It also gives you a repeatable diagnostic checklist for a later deployment.
Try it yourself
A controller should maintain four replicas. Two are ready, one is starting, and one failed to pull its image. Explain why changing the replica count to six is not the first repair, and name two observations to inspect.
Show a possible solution
The desired count is already four; the problem is convergence and readiness. Inspect the failed Pod events and image reference or registry access, then inspect readiness and available node resources. More replicas can reproduce the same failure and increase resource pressure.
Check your understanding
Try 11 questions across containers and kubernetes. Read each explanation and revisit anything that needs another pass.
Practise this subjectGo to the source
Use these primary references to check details and explore the topic further.
Saved in this browser. Signed-in progress syncs to your account.