kubectl 1.37 cheatsheet

kubectl 1.37: Rollouts and scaling

6 common kubectl 1.37 tasks.

Scale a deployment

Set the number of replicas.

kubectl scale deployment web --replicas=3

Update the image

Change a container's image, which starts a rolling update.

kubectl set image deployment/web web=nginx:1.27

Watch a rollout

Wait and report until the rollout finishes.

kubectl rollout status deployment/web

See rollout history

List the revisions of a deployment.

kubectl rollout history deployment/web

Roll back a deployment

Return to the previous revision.

kubectl rollout undo deployment/web

Restart a deployment

Restart all pods gradually, without changing the spec.

kubectl rollout restart deployment/web

Was this page helpful?