Posts

Showing posts with the label pv

Persistent Storage for Kubernetes with StorageClass

In Kubernetes, managing persistent storage involves creating a StorageClass , which defines the types of storage to be used for persistent volumes (PV). Here's a step-by-step explanation of how to use dynamic provisioning for persistent storage in a Kubernetes cluster. Step 1: Declare a StorageClass A StorageClass is a way to describe the provisioning of storage in a Kubernetes cluster. It defines parameters such as the storage provider (e.g., Amazon EBS, NFS, etc.) and other configuration details. Depending on your cluster, there may already be a default StorageClass . If not, you will need to manually declare one. Example of defining a StorageClass for Amazon EBS: apiVersion : storage.k8s.io/v1 kind : StorageClass metadata : name : ebs-sc provisioner : kubernetes.io/aws-ebs parameters : type : gp2 Step 2: Create a PersistentVolumeClaim (PVC) Once the StorageClass is defined, you can create a PersistentVolumeClaim (PVC) that requests a specific amount of storage from a S...