Reputation: 317
I am new to kubernetes. To learn more about kubernetes, I am trying to deploy backstage to a 9-node Pi kubernetes cluster I deployed with ansible. I am following this article https://backstage.io/docs/deployment/k8s/
To prepare, i am trying to deploy first to a minikube single-node cluster on my Apple laptop.
As have many others, I am getting an error in deploying my postgres container with "Error: stat /mnt/data: no such file or directory"
That directory exists on my laptop and, though I don't want to, I set it to 777 since I am not certain under what context minikube is running.
Some have suggested that is misleading message; that said, it's my undertanding (which no one has clearly specified that i have seen) that the postgres database that would reside in /var/lib/postgresql/data would be persisted in /mnt/data on my laptop. Is that true?
Here are my deployment scripts:
apiVersion: v1
kind: PersistentVolume
metadata:
name: postgres-storage
namespace: classicrock
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 2G
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
hostPath:
path: '/mnt/data'
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: postgres-storage-claim
namespace: classicrock
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2G
volumeName: postgres-storage
and
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres
namespace: classicrock
spec:
replicas: 1
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: postgres
image: postgres:17.4-alpine
imagePullPolicy: 'IfNotPresent'
ports:
- containerPort: 5432
envFrom:
- secretRef:
name: postgres-secrets
env:
- name: POSTGRES_HOST
value: postgres.classicrock
- name: POSTGRES_PORT
value: '5432'
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: postgresdb
subPath: data
volumes:
- name: postgresdb
persistentVolumeClaim:
claimName: postgres-storage-claim
Upvotes: 0
Views: 25