What is a Deployment in Kubernetes? (with kubectl examples)
What a Kubernetes Deployment is, how it manages Pods and ReplicaSets, kubectl get/describe/rollout commands, common beginner mistakes, and optional natural-language checks with kprompt.
If you searched what is a deployment in kubernetes, here is the short version: a Deployment is the controller you usually create for a stateless app. It declares how many Pod copies you want, which container image to run, and how updates should roll out. Kubernetes then creates and replaces Pods so reality matches that declaration.
This page is Deployment-first. For the Pod vs Deployment comparison, see Pods vs Deployments. For how traffic reaches those Pods, see Service vs Deployment.
The one-sentence version
- A Deployment is desired state for a set of identical Pods (replicas + template).
- It owns ReplicaSets, which create the actual Pods.
- You rarely create lone Pods in production — you create a Deployment.
What a Deployment actually does
You give Kubernetes a Pod template (containers, ports, labels, probes) and a replica count. The Deployment controller creates a ReplicaSet. The ReplicaSet creates Pods. If a Pod dies or a node fails, a replacement Pod appears. If you change the image, the Deployment performs a rolling update (by default) and keeps history so you can roll back.
Mental model
Deployment "api"
└── ReplicaSet (current revision)
├── Pod api-aaa
├── Pod api-bbb
└── Pod api-ccckubectl commands that stick
Inspect and manage a Deployment
kubectl get deployments -n staging
kubectl describe deployment api -n staging
kubectl get pods -l app=api -n staging
kubectl scale deployment api --replicas=3 -n staging
kubectl rollout status deployment/api -n staging
kubectl rollout undo deployment/api -n staging
kubectl rollout history deployment/api -n stagingREADY columns on kubectl get deploy show desired vs available replicas. If READY is 0/3, dig into Pods next — status reasons live on the Pod objects. See kubectl get pods explained.
Common beginner mistakes
- Creating a bare Pod YAML for an app that should restart and scale → use a Deployment
- Editing a live Pod and expecting the change to survive → the Deployment recreates Pods from the template
- Treating the Pod name as stable → names change on recreate; the Deployment name stays
- Forgetting labels → Services cannot select Pods if labels/selectors do not match
Optional natural-language checks
kprompt can list and explain Deployments as reads. Scaling or restarting still produces a plan you approve.
Soft kprompt examples
kprompt "list deployments in staging"
kprompt "describe deployment api in staging"
kprompt "scale api to 3 in staging" # review plan → y or nWhat to learn next
Compare objects with Pods vs Deployments, then networking with Services / Service vs Deployment, then Namespaces. Day-2 tooling: kubectl vs K9s.
Related posts
Kubernetes labels and selectors explained (the glue between objects)
Labels and selectors in Kubernetes: how Deployments label Pods, how Services find them, kubectl -l and endpoints checks, common mistakes, and optional kprompt examples.
Read articleKubernetes Service vs Deployment: roles, not rivals
Service vs Deployment in Kubernetes: Deployments run and update Pods; Services give those Pods a stable network identity. When you need each, how they connect via labels, and kubectl checks that stick.
Read articlekubectl get pods explained: STATUS, restarts, and next commands
How to read kubectl get pods output — READY, STATUS, RESTARTS, AGE — what CrashLoopBackOff and Pending mean, and which kubectl command to run next.
Read article