> ## 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 Use a Sidecar Container to Collect Redis Logs in Kubernetes
- URL: https://skills.devopscube.com/cka-practice-questions/kubernetes-pod-troubleshooting-fix-an-emptydir-volume/
- Published: 2026-09-17T14:53:36.000Z
- Updated: 2026-10-14T11:59:57.000Z
- Author: Sulaiman
- Tags: Troubleshooting, #CKA-Exam-question, #docs

You are given a Kubernetes Pod manifest at `storage.yaml`. The manifest contains configuration errors that prevent the Pod from being deployed successfully.

`storage.yaml` manifest:

```YAML
apiVersion: v1
kind: Pod
metadata:
  name: storage-pod
spec:
  containers:
    - name: storage-container
      image: nginx
      volumeMounts:
        - name: temp-storage
          mountPath: /app/temp
  volumes:
    - name: temp-storage
      emptyDir: {}
```

Your task is to inspect and troubleshoot, correct all configuration errors, and deploy the Pod in the namespace.

The Pod must:

- Be named `storage-pod`.
- Use the `nginx` container image.
- Be in the Running state.
- Define an `emptyDir` volume named `temp-storage`.
- Mount `temp-storage` at `/app/temp` inside the container.

After deploying the Pod, verify that the volume is correctly defined and mounted at `/app/temp`.

📚

For more details about [Pod](https://kubernetes.io/docs/concepts/workloads/pods/?ref=skills.devopscube.com), [Volumes](https://kubernetes.io/docs/concepts/storage/volumes/?ref=skills.devopscube.com) refer to the official Kubernetes documentation.

🙅‍♀️

Do not create a new manifest from scratch.

---

### Identify the Errors

The provided manifest has 4 issues

### Compare the two manifests

Broken Fixed 

storage-pod.yaml before 

apiVersion: v1/beta kind: pod metadata:  name: storage-pod spec:  containers:  \- name: storage-container  image: nginx  VolumeMounts:  \- name: temp-storage  mountPath: /app/temp  Volumes:  \- name: temp-storage  emptyDir: {} 

storage-pod.yaml after Copy 

apiVersion: v1 kind: Pod metadata:  name: storage-pod spec:  containers:  \- name: storage-container  image: nginx  volumeMounts:  \- name: temp-storage  mountPath: /app/temp  volumes:  \- name: temp-storage  emptyDir: {} 

**Line 1: Incorrect `apiVersion`**

The manifest uses an invalid API version, `v1/beta`.For a Kubernetes Pod, the correct API version is `v1`.

**Line 2: Incorrect `kind`**

The manifest uses an incorrect resource kind, `pod`. Kubernetes resource kinds are case-sensitive, so the correct value is `Pod`.

**Line 9: Incorrect `volumeMounts` field**

The manifest uses an incorrect field name, `VolumeMounts`. The correct field is `volumeMounts`, with a lowercase v and m.

**Line 12: Incorrect `volumes` field**

The manifest uses an incorrect field name, `Volumes`. The correct field is `volumes`, with a lowercase v.

### Deploy the Pod

Apply the corrected manifest:

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

pod/storage-pod created
```

### Verify the Pod Status

Check the Pod:

```sh
$ kubectl get pod storage-pod

NAME           READY   STATUS    RESTARTS   AGE
storage-pod    1/1     Running   0          10s
```

### Verify the Volume, Mount

Check the `/app/temp` directory inside the container:

```sh
$ kubectl exec -it storage-pod -- ls /app/temp
```

The directory should exist because the `emptyDir` volume is mounted there.

You can also verify the mount configuration with:

```
kubectl describe pod storage-pod
```

Look for the `Mounts` section:

```
Mounts:
  /app/temp from temp-storage
```

And the `Volumes` section should show:

```
Volumes:
  temp-storage:
    Type:       EmptyDir
```

## Why Does the Volume Name Matter?

The volume name defined under `volumes` must match the name referenced under `volumeMounts`. For example, if `volumeMounts` uses`name: temp-storage`, the `volumes` section must define a volume with the same name. 

This matching name allows Kubernetes to associate the container's mount path with the correct volume. If the names do not match, the Pod configuration is invalid and Kubernetes cannot mount the volume.

## What Is a Kubernetes emptyDir Volume?

An `emptyDir` volume is a temporary volume created when a Pod is assigned to a node. It starts empty and can be shared by containers within the same Pod to store temporary data. 

For example, `volumes: - name: temp-storage emptyDir: {}` creates an `emptyDir` volume named `temp-storage`. The data remains available for the lifetime of the Pod and is deleted when the Pod is removed from the node.

## CKA Exam Tips

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

## Tip 1: Check API versions

When a manifest fails, first check whether the `apiVersion` is correct for the resource. For a Pod, use `apiVersion: v1`.

## Tip 2: Kubernetes field names are case-sensitive

These are different: `volumeMounts` and `VolumeMounts`. Kubernetes field names are case-sensitive, so always use the exact field name.

## Tip 3: Check indentation

Kubernetes YAML is indentation-sensitive. The volumes field belongs directly under spec, not inside the container definition.

## Tip 4: Match volume names

Always use the same volume name in both `volumeMounts` and `volumes`. Here, both should use `temp-storage`.

## Tip 5: Verify instead of assuming

After applying the manifest, don't stop at `kubectl apply`. Verify that the Pod is running with `kubectl get pod storage-pod`, then confirm the volume mount using `kubectl describe pod storage-pod` or `kubectl exec -it storage-pod -- ls /app/temp`.