Kubectl Deployments
Create, update, and inspect Deployments that own your pods.
- kubectl deployment
- rolling update
- set image
- rollout status
- rollout undo
Kubectl Deployments
Create, update, and inspect Deployments that own your pods.
Commands
| Command | What it does |
|---|---|
kubectl get deploy | List deployments and ready ratios |
kubectl create deploy api --image=registry/api:v1 --replicas=3 | Create from CLI |
kubectl set image deploy/api api=registry/api:v2 | Rolling update to a new image |
kubectl rollout status deploy/api | Watch the rollout live |
kubectl rollout undo deploy/api | Roll back to the previous revision |
Example
kubectl create deploy api --image=registry/api:v1 --replicas=3
kubectl set image deploy/api api=registry/api:v2
kubectl rollout status deploy/api
FAQ
How do rolling updates avoid downtime?
maxUnavailable/maxSurge keep capacity while new pods pass readiness; tune them per service criticality.
Where is rollout history?
kubectl rollout history deploy/api; set revisionHistoryLimit to keep enough revisions.
Câu hỏi thường gặp
How do rolling updates avoid downtime?
maxUnavailable/maxSurge keep capacity while new pods pass readiness; tune them per service criticality.
Where is rollout history?
kubectl rollout history deploy/api; set revisionHistoryLimit to keep enough revisions.
Kubernetes
Kubectl Config and Context
Point kubectl at the right cluster and switch contexts safely.
Kubectl Pods
Inspect pods, describe failures, and get a shell inside.
Kubectl Services
Expose pods stably with ClusterIP, NodePort, and LoadBalancer.
Kubectl Ingress
Route external HTTP traffic to services by host and path.