Courseiva
Application Deployment →mediumMultiple Choice

CKAD Application Deployment Practice Question

You want to add an annotation to a pod without modifying the pod template. Which approach should you use?

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

kubectl annotate pod my-pod key=value

'kubectl annotate pod my-pod key=value' adds an annotation directly to the existing pod without modifying the pod template. Option A uses 'kubectl annotate deployment', which adds an annotation to the Deployment object itself, not to the pod. Option B uses 'kubectl label', which adds labels, not annotations. Option C uses 'kubectl edit', which is not a direct annotation command and may be less efficient.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    kubectl annotate deployment my-deployment key=value

    Why it's wrong here

    The `kubectl annotate` command accepts any resource type, but specifying `deployment my-deployment` targets the Deployment object's own metadata. Pods created by a Deployment do not automatically inherit annotations placed on the Deployment's top-level metadata; that metadata belongs solely to the Deployment resource. To annotate the actual Pods, you must either annotate the Pod directly (as in the correct answer) or update the `spec.template.metadata.annotations` field in the Deployment so that future Pods are created with the annotation. This command therefore leaves the intended Pod completely unchanged.

  • ✗

    kubectl label pod my-pod key=value

    Why it's wrong here

    `kubectl label` is dedicated to managing labels, which are key-value pairs used for resource selection, grouping, and organization. Annotations are a separate metadata field designed for non-identifying information, such as tooling hints, build versions, or audit notes. Running `kubectl label pod my-pod key=value` adds a label to the Pod's `metadata.labels` map, not an annotation to `metadata.annotations`. Even though the syntax is similar, the command does not satisfy the request because it modifies the wrong metadata namespace and semantics.

  • ✗

    kubectl edit pod my-pod and add annotation manually

    Why it's wrong here

    Using `kubectl edit` modifies the live pod object in the cluster, but the annotation is lost if the pod is recreated by its controller (e.g., a Deployment), because the change is not persisted in the pod template. This is tempting because `kubectl edit` is a direct, interactive way to alter a running resource, and it would be correct for adding an annotation to a statically created pod that is not managed by a higher-level controller.

  • ✓

    kubectl annotate pod my-pod key=value

    Why this is correct

    This is the precise imperative command to add an annotation to a Pod object in the cluster. `kubectl annotate pod my-pod key=value` directly updates the `metadata.annotations` map of the specified Pod, and the change is immediately visible to the API server. This approach works for any Pod, but it is especially appropriate when the Pod is statically created or when you intentionally want to modify only the live object. For controller-managed Pods, remember that this change is ephemeral — if the Pod is recreated by its Deployment or ReplicaSet, the annotation will be lost unless the Pod template is also updated.

About these practice questions

One of 826 original CKAD practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This CKAD practice question is part of Courseiva's free CNCF certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CKAD exam.