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

CommandWhat it does
kubectl get deployList deployments and ready ratios
kubectl create deploy api --image=registry/api:v1 --replicas=3Create from CLI
kubectl set image deploy/api api=registry/api:v2Rolling update to a new image
kubectl rollout status deploy/apiWatch the rollout live
kubectl rollout undo deploy/apiRoll 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.

常见问题

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