Skip to content

Create Block Storage

Azure, AWS, and Google Cloud (Dynamic Provisioning)

Dynamic Provisioning for All Cloud Providers

The following PVC manifests work for Azure, AWS, and Google Cloud using dynamic provisioning. Kubernetes will automatically create the underlying persistent volumes based on the storage classes

  • Azure: Uses Azure Disk CSI driver (disk-csi)
  • AWS: Uses AWS EBS CSI driver (disk-csi)
  • GCP: Uses GCP Persistent Disk CSI driver (disk-csi)

No manual PV creation is required - just apply the PVC manifests below.

PV and PVC

cloud-block-dynamic.yaml
# PersistentVolumeClaim for Database (Dynamic)
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: qmig-db-pvc
  namespace: {{namespace}}                   # Replace with your namespace
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: disk-csi
  resources:
    requests:
      storage: 5Gi
---
# PersistentVolumeClaim for Cache (Dynamic)
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: qmig-cache-pvc
  namespace: {{namespace}}                   # Replace with your namespace
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: disk-csi
  resources:
    requests:
      storage: 5Gi

Apply:

kubectl apply -f cloud-block-dynamic.yaml

Minikube & Docker Desktop - Block Storage (Static Provisioning)

OS-Specific Path Configuration

The hostPath in the PV manifests must be updated based on your operating system and desired location:

  • Linux/macOS: Use absolute paths like /data/qmig-db or /home/user/qmigrator/db
  • Windows (Docker Desktop): Use WSL2 paths like /run/desktop/mnt/host/c/data/qmig-db
  • Windows (Minikube): Mount local drives and use paths like /hostpc/qmig-db

Ensure the directories exist and have appropriate permissions before applying the manifests.

local-block-storage.yaml
# PersistentVolume for Database
apiVersion: v1
kind: PersistentVolume
metadata:
  name: qmig-db-pv
spec:
  capacity:
    storage: 5Gi
  accessModes:
    - ReadWriteOnce
  storageClassName: local-csi
  hostPath:
    path: /data/qmig-db                    # Update path as needed
---
# PersistentVolumeClaim for Database
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: qmig-db-pvc
  namespace: {{namespace}}                 # Replace with your namespace
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: local-csi
  resources:
    requests:
      storage: 5Gi
  volumeName: qmig-db-pv
---
# PersistentVolume for Cache
apiVersion: v1
kind: PersistentVolume
metadata:
  name: qmig-cache-pv
spec:
  capacity:
    storage: 5Gi
  accessModes:
    - ReadWriteOnce
  storageClassName: local-csi
  hostPath:
    path: /data/qmig-cache                 # Update path as needed
---
# PersistentVolumeClaim for Cache
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: qmig-cache-pvc
  namespace: {{namespace}}                 # Replace with your namespace
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: local-csi
  resources:
    requests:
      storage: 5Gi
  volumeName: qmig-cache-pv

Apply:

kubectl apply -f local-block-storage.yaml