🎓 A1Learner
🔍
0 of 51 lessons completed

Kubernetes: What Is a Deployment?

A Deployment is an object that keeps a stated number of identical Pods running. A Deployment states the desired state, and Kubernetes works to match it.

Three copies, always

3/3 means all three copies are ready. The Deployment holds that count.

kubectl get deployments

The Pods behind the count

The Deployment made three Pods. Their names share the Deployment name plus a random ending.

kubectl get pods

A Pod dies, the count stays

Delete one Pod and a new one takes its place. A Deployment heals itself.

kubectl delete pod web-6d9f8b7c4d-abc12

Example

kubectl get deployments
kubectl get pods

Key points

  • Desired state: the number of copies and the image you ask Kubernetes to keep running.
  • Use a Deployment to run an app that must stay up, like a web server.
  • Kubernetes replaces a Pod that dies, so the count stays at the stated number.
  • A Deployment can swap in a new image without stopping the app.
  • Replica: one copy of a Pod, counted by the Deployment.

In this example, get deployments shows one Deployment with 3 of 3 replicas ready. get pods shows the three Pods it owns. The Deployment keeps the count at three, and it replaces any Pod that dies.

Note

A Pod made by hand has no owner, so nothing replaces it when it dies.

Try it Yourself

Edit the code, then press Run.

Running is simulated · Rust Playground

Exercise

What is the main job of a Deployment?