> ## Content Index
> Fetch the complete content index at: https://skills.devopscube.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to Debug a Kubernetes Deployment
- URL: https://skills.devopscube.com/debug-a-kubernetes-deployment/
- Published: 2026-09-17T14:40:23.000Z
- Updated: 2026-10-14T11:57:41.000Z
- Author: Sulaiman
- Tags: Troubleshooting, #blog, #CKA-Exam-question, #docs

The DevOps team wants to deploy a test application for a POC. They have provided a Deployment manifest, but the configuration contains errors.

`deploy.yaml` manifest:

```yaml
apiVersion: apps/v1
kind: deployment
metadata:
  name: devopscube
spec:
  replicas: 2
  selector:
    matchLabels:
      type: test
  template:
    metadata:
      labels:
        type: test
    spec:
      containers:
      - name: busybox-container
        image: busyboxx
        command:
        - /bin/sh
        - "-c"
        - echo This is devopscube && sleep 3600
```

Your task is to troubleshoot the Deployment, identify and fix the errors, and ensure that all Pods managed by the Deployment are running successfully.

📚

For more details about [Deployment](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/?ref=skills.devopscube.com), refer to the official Kubernetes documentation.

🙅‍♀️

Do not create a new manifest from scratch.

---

### Identify the Errors

There are **two issues** provided manifest has two issues

### Compare the two manifests

Broken Fixed 

deployment.yaml before 

apiVersion: apps/v1 kind: deployment metadata: name: devopscube spec: replicas: 2 selector: matchLabels: type: test template: metadata: labels: type: test spec: containers:  \- name: busybox-container image: busyboxx command:  \- /bin/sh  \- "-c"  \- echo This is devopscube && sleep 3600 

deployment.yaml after Copy 

apiVersion: apps/v1 kind: Deployment metadata: name: devopscube spec: replicas: 2 selector: matchLabels: type: test template: metadata: labels: type: test spec: containers:  \- name: busybox-container image: busybox command:  \- /bin/sh  \- "-c"  \- echo This is devopscube && sleep 3600 

**Line 2: Incorrect `kind`**

The manifest uses`kind: deployment`, but Kubernetes resource kinds are case-sensitive. The correct value is `kind: Deployment`. Using the incorrect lowercase value prevents Kubernetes from recognizing the resource type correctly.

**Line 17: Incorrect Container Image**

The manifest uses`image: busyboxx`, but the image name contains an extra `x`. The correct image is `image: busybox`. Because `busyboxx` is not the intended image, Kubernetes cannot pull the correct container image, preventing the container from starting successfully.

### Deploy the Corrected Manifest

Apply the corrected file:

```sh
$ kubectl apply -f deploy.yaml

deployment.apps/devopscube created
```

### Verify the Deployment

Check the Deployment:

```sh
$ kubectl get deployment devopscube

NAME         READY   UP-TO-DATE   AVAILABLE   AGE
devopscube   2/2     2            2           117s
```

The important value is `READY: 2/2`. This confirms that both requested replicas are ready.

### Verify the Pods

List the Pods. You should see two Pods managed by the Deployment.

```sh
$ kubectl get pods

NAME                          READY   STATUS    RESTARTS   AGE
devopscube-77785d786f-8ttmp   1/1     Running   0          3m46s
devopscube-77785d786f-tswfd   1/1     Running   0          3m46s
```

Both Pods should show **`READY 1/1`** and **`STATUS Running`**, confirming they are running successfully and ready to serve traffic.

### Verify the Application

You can check the container logs using:

```
$ kubectl logs devopscube-77785d786f-8ttmp

This is devopscube
```

The `sleep 3600` command keeps the container running for the duration of the test.

## CKA Exam Tips

These tips will help you quickly identify the important Kubernetes concepts and avoid common mistakes during the exam.

## Tip 1: Read the Error Message

When a resource fails, run `kubectl apply -f deploy.yaml` and read the error carefully. It often tells you exactly what needs to be fixed.

## Tip 2: Check the Resource Status

Check the Deployment and Pod status to quickly identify problems:  
`kubectl get deployment`  
`kubectl get pods` 

## Tip 3: Use describe for Troubleshooting

If a Pod isn't running, use `kubectl describe pod <pod-name>` and check the Events section. It often provides useful clues about image pull failures, scheduling issues, startup failures, or configuration errors.

## Tip 4: Check Container Logs

If the container starts but the application isn't working as expected, check the container logs: `kubectl logs <pod-name>`Logs can help identify application-level errors.

## Tip 5: Check Deployment Selectors

Make sure the Deployment selector matches the labels in the Pod template. For example, `type: test` must be the same in both `matchLabels` and `labels`.