https://rancher.com/ logo
#k3s
Title
# k3s
b

best-wall-17038

08/07/2022, 5:43 PM
Hi All, I would like to deploy postgres in my local cluster but I am bit confused how should I configure the PV? Can someone help me pls ? Do I have to create any strogeclass or can I use
local-path
?
i

important-art-22288

08/07/2022, 7:20 PM
Are you deploying manually or using Helm? You should be able to create a persistent volume claim with
storageClassName: local-path
if you’re deploying manually and then link your deployment to the PVC
b

best-wall-17038

08/07/2022, 7:20 PM
Hi @important-art-22288 this is what I did and seems worked
Copy code
kind: PersistentVolume
apiVersion: v1
metadata:
  name: postgres-pv
  labels:
    app: postgres
    type: local
spec:
  storageClassName: local-path
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/var/data"
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: postgres-pvc
  labels:
    app: postgres
spec:
  storageClassName: local-path
  capacity:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
do you see any error here >
i

important-art-22288

08/07/2022, 7:22 PM
This looks correct, I believe you don’t need the persistent volume definition here, local-path will create the PVC from your PV
b

best-wall-17038

08/07/2022, 7:23 PM
thanks @important-art-22288
3 Views