0
0
Kubernetesdevops~15 mins

PersistentVolumeClaim (PVC) definition in Kubernetes - Mini Project: Build & Apply

Choose your learning style9 modes available
Create a PersistentVolumeClaim (PVC) in Kubernetes
📖 Scenario: You are setting up storage for a Kubernetes application. You need to create a PersistentVolumeClaim (PVC) to request storage from the cluster.
🎯 Goal: Learn how to write a YAML definition for a PersistentVolumeClaim (PVC) that requests storage with specific size and access mode.
📋 What You'll Learn
Create a YAML dictionary with apiVersion, kind, metadata, and spec fields
Set apiVersion to v1
Set kind to PersistentVolumeClaim
Add metadata with a name my-pvc
In spec, set accessModes to ReadWriteOnce
In spec, set resources.requests.storage to 1Gi
💡 Why This Matters
🌍 Real World
Kubernetes applications often need persistent storage to save data beyond the life of a pod. PVCs let you request this storage easily.
💼 Career
Understanding PVCs is essential for Kubernetes administrators and DevOps engineers to manage stateful applications and storage resources.
Progress0 / 4 steps
1
Create the basic PVC structure
Create a YAML dictionary with apiVersion set to v1, kind set to PersistentVolumeClaim, and metadata with name set to my-pvc.
Kubernetes
Need a hint?

Start by defining the top-level keys and the metadata name.

2
Add access mode to the spec
Add a spec section with accessModes set to a list containing ReadWriteOnce.
Kubernetes
Need a hint?

Remember that accessModes is a list under spec.

3
Add storage request to the spec
Under spec, add resources.requests.storage set to 1Gi to request 1 gigabyte of storage.
Kubernetes
Need a hint?

Indent resources, then requests, then set storage to 1Gi.

4
Display the complete PVC YAML
Print the complete YAML definition of the PersistentVolumeClaim.
Kubernetes
Need a hint?

Show the full YAML content as the final output.