Kubernetes and Cloud Native Associate (KCNA) Practice Questions

Kubernetes and Cloud Native Associate (KCNA) exam preparation

Kubernetes and Cloud Native Associate (KCNA) practice questions in English: 180 questions with explanations. The mock exam has 60 questions and 90 minutes.

Kubernetes and Cloud Native Associate (KCNA) free question 3 / 10 · Domain 1: Kubernetes Fundamentals

You change the container image in the Pod template of a Deployment to a new version. What does the Kubernetes documentation say happens?

  1. The template of the current ReplicaSet is edited, and the images of the running Pods change in place
  2. A new ReplicaSet is created and scaled up step by step while the old ReplicaSet is scaled down
  3. You edit the ReplicaSets that the Deployment owns and use them to roll out the new image
  4. The new template reaches the Pods once the Deployment is deleted and created again
Show the answer and explanation

Answer: B

Why this is correct
The Deployment page lists as a use case that you can declare the new state of the Pods by updating the PodTemplateSpec of the Deployment. A new ReplicaSet is created, and the Deployment gradually scales it up while scaling down the old ReplicaSet, which makes sure that Pods are replaced at a controlled rate. Each new ReplicaSet updates the revision of the Deployment, which is also what allows a rollback to an earlier revision if the current state is not stable. The page also warns against managing the ReplicaSets of a Deployment by hand, because the Deployment is the object that owns the update.

Why the other options are wrong
"The template of the current ReplicaSet is edited, and the images of the running Pods change in place" … Pods are not changed in place. The Deployment creates a new ReplicaSet for the new template, and Pods are replaced at a controlled rate.
"You edit the ReplicaSets that the Deployment owns and use them to roll out the new image" … The page tells you not to manage ReplicaSets that are owned by a Deployment. The Deployment does that work for you when you update its Pod template.
"The new template reaches the Pods once the Deployment is deleted and created again" … A Deployment provides declarative updates. Updating its PodTemplateSpec declares the new desired state, and the Deployment moves the Pods there, so no re-creation is needed.

A new template means a new ReplicaSet
Deployments update by replacement: a new ReplicaSet grows while the old one shrinks. Edit the Deployment, not its ReplicaSets.

Go to the Kubernetes and Cloud Native Associate (KCNA) practice app (10 free questions; purchase unlocks all questions)

See the full practice set