How would you scale a Deployment from 3 to 5 replicas using kubectl?

  1. kubectl set replicas deployment/my-app 5
  2. kubectl patch deployment my-app replicas=5
  3. kubectl scale deployment my-app --replicas=5 ✓
  4. kubectl update deployment my-app replicas=5

Correct answer: kubectl scale deployment my-app --replicas=5

Option C is correct because the proper kubectl syntax for scaling a Deployment is the scale subcommand with the resource type and name followed by the --replicas flag and the desired replica count, making kubectl scale deployment my-app --replicas=5 the correct and idiomatic command. Option A is incorrect because kubectl set replicas is not a valid kubectl command; the set subcommand supports image, env, and resources but does not have a replicas operation. Option B is incorrect because kubectl patch can technically modify replica counts but requires JSON or strategic merge patch syntax, not a simple key-value assignment; the form shown is not valid patch syntax. Option D is incorrect because kubectl update is not a valid kubectl subcommand; updates to resources are performed with apply, edit, patch, or set, not update.

Topic: · kubernetes, kubectl, deployments, scaling

Practice Certified Kubernetes Administrator (CKA) Questions Free