> ## 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.

# Create and Inspect a Kubernetes PersistentVolume
- URL: https://skills.devopscube.com/create-and-inspect-a-persistentvolume/
- Published: 2026-09-17T14:53:11.000Z
- Updated: 2026-10-14T10:49:29.000Z
- Author: Sulaiman
- Tags: #CKA-Exam-question, #docs, #blog, Storage

You are working on a Kubernetes cluster where a new application requires persistent storage.

Your taskis to createto create a Kubernetes PersistentVolume with the following specifications:

- **Name:** `devopscube-pv`
- **Volume type:** `HostPath`
- **Host path:** `/tmp/data`
- **Storage capacity:** `15Gi`
- **Access mode:** `ReadWriteMany`

After creating the PersistentVolume:

1. Verify that the PersistentVolume `devopscube-pv` has been created successfully.
2. Describe the PersistentVolume and inspect its configuration.
3. Retrieve the **reclaim policy** of `devopscube-pv` and save it to `/tmp/policy.txt`.
4. Verify that `/tmp/policy.txt` contains the reclaim policy.

📚

For more details on PersistentVolume, see the [official Kubernetes documentation.](https://kubernetes.io/docs/concepts/storage/persistent-volumes/?ref=skills.devopscube.com)

---

### Create the PersistentVolume Manifest

Create a file named devopscube-pv.yaml 

💡

If you’re unsure about the YAML structure or syntax, check the official Kubernetes documentation for a clear reference.

The manifest should look like this:

persistent-volume.yaml Copy 

apiVersion: v1 kind: PersistentVolume metadata:  name: devopscube-pv spec:  capacity:  storage: 15Gi  accessModes:  \- ReadWriteMany  hostPath:  path: /tmp/data 

The PersistentVolume (PV) is configured with a storage capacity of `15Gi` and uses the `ReadWriteMany` access mode, which allows the volume to be mounted as read-write by multiple nodes, depending on the capabilities of the underlying storage. The PV uses a `HostPath` volume that maps the host directory `/tmp/data` to the volume.

### Apply the Manifest

Create the PersistentVolume:

```sh
$ kubectl apply -f devopscube-pv.yaml

persistentvolume/devopscube-pv created
```

### Verify the PersistentVolume

Check the PV:

```sh
$ kubectl get pv

NAME            CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS      CLAIM   STORAGECLASS   VOLUMEATTRIBUTESCLASS   REASON   AGE
devopscube-pv   15Gi       RWX            Retain           Available                          <unset>    
```

Because no PersistentVolumeClaim has been created yet, the PV should normally be in the `Available` state.

### Describe the PersistentVolume

Describe the PV:

```sh
$ kubectl describe pv devopscube-pv

Name:            devopscube-pv
Labels:          <none>
Annotations:     <none>
Finalizers:      [kubernetes.io/pv-protection]
StorageClass:    
Status:          Available
Claim:           
Reclaim Policy:  Retain
Access Modes:    RWX
VolumeMode:      Filesystem
Capacity:        15Gi
Node Affinity:   <none>
Message:         
Source:
    Type:          HostPath (bare host directory volume)
    Path:          /tmp/data
    HostPathType:  
```

The output contains information about the PV, including:

```
Capacity:          15Gi
Access Modes:      RWX
Reclaim Policy:    Retain
```

The exact reclaim policy may depend on the Kubernetes configuration and cluster defaults. For this task, capture the value reported by your cluster rather than assuming it.

### Save the Reclaim Policy

Extract the reclaim policy from the PV description:

```
kubectl describe pv devopscube-pv | grep "Reclaim Policy" > /tmp/policy.txt
```

Verify the file:

```
$ cat /tmp/policy.txt

Reclaim Policy:  Retain
```

This confirms that the reclaim policy information has been saved to `/tmp/policy.txt`.

## CKA Exam Tips

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

### Tip 1: Know the Access Mode Abbreviations

Kubernetes displays access modes as:

```
ReadWriteOnce  → RWO,
ReadOnlyMany   → ROX,
ReadWriteMany  → RWX
```

For this task, use `ReadWriteMany`, which appears as `RWX`.

### Tip 2: Check the HostPath

Make sure the PV uses the required path:

```
hostPath:
  path: /tmp/data
```

### Tip 3: Don't Assume the PV Is Bound

A new PV without a matching PVC normally has an **Available** status. It becomes **Bound** when a suitable PVC claims it.