Files
homelab/k8s/infrastructure/longhorn/longhorn-cnpg-storageclass.yaml
T

26 lines
788 B
YAML

# StorageClass specifically for CNPG (CloudNativePG) PostgreSQL clusters
# Fixes the "read-only filesystem" issue by mounting with postgres UID/GID
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: longhorn-cnpg
namespace: longhorn-system
annotations:
storageclass.kubernetes.io/is-default-class: "false"
provisioner: driver.longhorn.io
allowVolumeExpansion: true
parameters:
numberOfReplicas: "3"
staleReplicaTimeout: "30"
fromBackup: ""
dataLocality: "best-effort"
fsType: "ext4"
# Mount options to ensure PostgreSQL can write
mkfsParams: "-O ^64bit,^metadata_csum"
mountOptions:
- "noatime"
# Critical: mount with postgres UID/GID (26:26) to avoid permission issues
- "uid=26"
- "gid=26"
reclaimPolicy: Delete
volumeBindingMode: Immediate