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
kubectl describe explained: what to look for on Pods and Deployments
kubectl describe vs get: how to read Pod and Deployment output, Events, Conditions, lastState, and which command to run next. Optional kprompt examples.
Read articleKubernetes ConfigMap vs Secret: what beginners need to know
ConfigMap vs Secret in Kubernetes: when to use each, env vars and volume mounts, kubectl get/describe, common beginner mistakes, and optional kprompt examples.
Read articleKubernetes 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 article