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> # (1)!
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>
spec:
accessModes:
- ReadWriteOnce
storageClassName: disk-csi
resources:
requests:
storage: 5Gi
- Replace with your target Kubernetes namespace (e.g.,
qmigrator).
Apply:
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
/home/user/qmigrator/db - Windows (Docker Desktop): Use WSL2 paths like
/run/desktop/mnt/host/c/qmigrator/db - Windows (Minikube): Mount local drives and use paths like
/hostpc/db
Ensure the directories exist and have appropriate permissions before applying the manifests.
Paths from Minikube Mount
Ensure /path exists on the host and is mounted /mnt/qmigrator when starting Minikube (for example, use --mount-string="/path:/mnt/qmigrator").
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: /mnt/qmigrator/db # (1)!
---
# PersistentVolumeClaim for Database
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: qmig-db-pvc
namespace: <namespace> # (2)!
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: /mnt/qmigrator/cache # (3)!
---
# PersistentVolumeClaim for Cache
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: qmig-cache-pvc
namespace: <namespace> # (4)!
spec:
accessModes:
- ReadWriteOnce
storageClassName: local-csi
resources:
requests:
storage: 5Gi
volumeName: qmig-cache-pv
- Update to match your Minikube/Docker Desktop mount path for database storage (e.g.,
/mnt/qmigrator/db). - Replace with your target Kubernetes namespace (e.g.,
qmigrator). - Update to match your Minikube/Docker Desktop mount path for cache storage (e.g.,
/mnt/qmigrator/cache). - Replace with your target Kubernetes namespace (e.g.,
qmigrator).
Apply: