I have started minikube with --mount --mount-string “/path/to/local/directory:/data” and kvm2 driver. Followed every tutorial blog to a T to get persistent volume created for postgres to work but keep getting the following error:
The files belonging to this database system will be owned by user “postgres”.
This user must also own the server process.
The database cluster will be initialized with locale "en_US.utf8". The default database encoding has accordingly been set to "UTF8". The default text search configuration will be set to "english". Data page checksums are disabled. initdb: directory "/var/lib/postgresql/data" exists but is not empty If you want to create a new database system, either remove or empty the directory "/var/lib/postgresql/data" or run initdb with an argument other than "/var/lib/postgresql/data".
The pv and pvc are created successfully and bound. Here’s the yaml section for postgres pod:
spec: hostname: postgres containers: - name: postgres image: postgres:9.5 imagePullPolicy: "IfNotPresent" ports: - containerPort: 5432 volumeMounts: - mountPath: /var/lib/postgresql/data name: postgresdb volumes: - name: postgresdb persistentVolumeClaim: claimName: postgres-pv-claim
Is this a postgres issue? minikube issue? or both? Can’t figure out and spent more than couple of weeks trying to. None of the resources on the internet that say it should work have helped (so far).