Hello everybody, I am trying to make the orion db ...
# ask-community
f
Hello everybody, I am trying to make the orion db persistent by linking a volume to orion server, but the db still ephemeral and each time the container is crashed, data is missed. here is the manifest file I am using, looking forward to helping me to figure out what is the issue
Copy code
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: prefect
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 3Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: prefect
  name: orion
spec:
  selector:
    matchLabels:
      app: orion
  replicas: 1  
  template:
    metadata:
      labels:
        app: orion
    spec:
      containers:
      - name: api
        image: prefecthq/prefect:2.6.0-python3.10
        command: ["prefect", "orion", "start", "--host", "0.0.0.0", "--log-level", "WARNING"]
        ports:
        - containerPort: 4200
        env:
          - name: PREFECT_API_URL
            value: '<https://mydomain/api>'
        volumeMounts:
          - mountPath: ~/.prefect
            name: prefect
      restartPolicy: Always
      volumes:
        - name: prefect
          persistentVolumeClaim:
            claimName: prefect
1
q
You're trying to mount your PV to
~/.prefect
, but
~
does not get expanded by K8s (tilde pointing to homedir is a shell concept), so your volume gets mounted into a folder called
/~
.
Copy code
df -h
# Filesystem                Size      Used Available Use% Mounted on
# /dev/storageclass/pvcname
#                           2.9G      6.0M      2.9G   0% /~/.prefect
Try changing
mountPath
to
/root/.prefect
or setting `PREFECT_HOME`(ref).
🙌 2
f
Thanks so much @Q, it works properly now
👍 2