Container Orchestration with Kubernetes

⏱ 1 min remaining

Storage in Kubernetes

  • Persistent Volume (PV): Represents a piece of storage in the cluster with specific capacity and access modes.
apiVersion: v1
kind: PersistentVolume
metadata:
  name: my-pv
spec:
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/path/on/host"
  • Persistent Volume Claim (PVC): Requests a specific amount of storage with specified characteristics.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: my-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  • Storage Classes: Defines storage configurations and provisions PVs dynamically based on PVC requests.
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: my-storage-class
provisioner: kubernetes.io/aws-ebs