Challenge, Easy,  on  Kubernetes

Perform In-Place Updates on a Kubernetes Deployment

Scenario

You are working with a Kubernetes Deployment running in the prod namespace.

An existing Deployment named nginx-deployment is already running with two containers:

ContainerImage
nginxpublic.ecr.aws/nginx/nginx:stable-alpine
sidecarbusybox:latest

Task

Make the following changes to the nginx-deployment Deployment in the prod namespace:

  1. Update the nginx container image to public.ecr.aws/nginx/nginx:alpine
  2. Update the sidecar container image to busybox:musl
  3. Rename the nginx container to nginx-prod
  4. Rename the sidecar container to sidecar-prod
  5. Change the update strategy to Recreate
  6. Scale the Deployment to 3 replicas

Ensure the Deployment reaches a healthy state after applying all changes.


Hint — Editing a Deployment In-Place

The fastest way to apply all changes at once is to edit the Deployment directly — one edit triggers a single rollout:

kubectl edit deployment nginx-deployment -n prod

Inside the editor, update name, image, strategy.type, and replicas all in one save.

Alternatively, you can update images without editing using kubectl set image. Note that this only updates images — container names, strategy, and replicas still require a direct edit:

kubectl set image deployment/nginx-deployment -n prod \
  nginx=public.ecr.aws/nginx/nginx:alpine \
  sidecar=busybox:musl

Scale replicas separately:

kubectl scale deployment nginx-deployment -n prod --replicas=3

After any change, verify the rollout completes:

kubectl rollout status deployment/nginx-deployment -n prod

Documentation


Test Cases