nerdexam
Linux_Foundation

CKAD · Question #12

Context: Set configuration context: [student@node-1] $ kubectl config use-context nk8s Task: A deployment is falling on the cluster due to an incorrect image being specified. Locate the deployment…

The task requires the test-taker to locate a failing Kubernetes deployment, identify the incorrect image specified within its configuration, and correct it using kubectl edit.

Submitted by hans_de· May 4, 2026Application Deployment

Question

Context: Set configuration context: [student@node-1] $ kubectl config use-context nk8s Task: A deployment is falling on the cluster due to an incorrect image being specified. Locate the deployment, and fix the problem.

Exhibits

CKAD question #12 exhibit 1
CKAD question #12 exhibit 2
CKAD question #12 exhibit 3
CKAD question #12 exhibit 4
CKAD question #12 exhibit 5
CKAD question #12 exhibit 6

Explanation

The task requires the test-taker to locate a failing Kubernetes deployment, identify the incorrect image specified within its configuration, and correct it using kubectl edit.

Approach. The core of the task is to fix a 'failing deployment' due to an 'incorrect image'. The provided terminal output shows a pod that is running, which contradicts the problem description. This implies the provided images are either a red herring, or only show the initial context, and the actual failing deployment is elsewhere on the cluster.

Here's the step-by-step correct interaction:

  1. Set the Kubernetes context: The task context explicitly states kubectl config use-context nk8s. This command should be executed first to ensure interactions are with the correct cluster.
  2. Locate the failing deployment: Since the task states 'A deployment is falling' and the nginx-resources pod shown is running, the test-taker must look for deployments. To find all deployments across all namespaces, use: kubectl get deployments -A (or kubectl get deploy -A).
  3. Identify the problematic deployment: Look for deployments with non-ready replicas, or whose associated pods are in a CrashLoopBackOff or ErrImagePull state. This might require further investigation using kubectl get pods -n <namespace> for pods related to the deployments, or kubectl describe deployment <deployment-name> -n <namespace>.
  4. Edit the deployment: Once the failing deployment (e.g., my-bad-deployment in my-namespace) is identified, use the kubectl edit command to modify its configuration: kubectl edit deployment my-bad-deployment -n my-namespace.
  5. Correct the image name: Inside the editor (e.g., vi), navigate to the spec.template.spec.containers[0].image field. This field will contain the incorrectly specified image. Correct it to the appropriate, valid image name (e.g., change nginx:latestt to nginx:latest or my-wrong-registry/my-app:v1 to my-correct-registry/my-app:v1).
  6. Save and exit: Save the changes and exit the editor (:wq in vi/vim). Kubernetes will automatically update the deployment, and new pods will be created with the corrected image.

Common mistakes.

  • common_mistake. A common mistake would be to assume the nginx-resources pod shown in the exhibit is the 'deployment' referred to in the task, and try to debug it. This is incorrect because:
    • The task explicitly refers to a 'deployment', not a 'pod'.
    • The nginx-resources pod is shown as 'Running' and 'READY 1/1', indicating it is not 'falling' due to an incorrect image.
    • Trying to re-create or delete the nginx-resources pod would not address the actual problem of a failing deployment somewhere else on the cluster. Another mistake would be to use kubectl set image without first identifying the correct deployment, or to directly modify a pod's image, which would be overwritten by its controlling deployment.

Concept tested. This question tests the candidate's ability to:

  • Navigate and troubleshoot Kubernetes clusters using kubectl.
  • Understand the difference between Pods and Deployments.
  • Identify and debug failing Kubernetes resources (specifically Deployments and associated Pods).
  • Use kubectl get, kubectl describe, and kubectl edit commands effectively.
  • Understand the structure of Kubernetes resource definitions (especially image specification within a Deployment's pod template).
  • Apply critical thinking to distinguish between information provided in exhibits and the actual problem statement.

Reference. https://kubernetes.io/docs/concepts/workloads/controllers/deployment/

Topics

#Deployment troubleshooting#Image configuration#kubectl edit#Application debugging

Community Discussion

No community discussion yet for this question.

Full CKAD Practice