I have a k8s cluster for educational purposes. It has postgres one pod, but I can't load or dump db to postgres to initialise it.

I added a pv and pvc for /docker-entrypoint-initdb.d and added locate dump.sql to it.

The postgres pod and service in k8s work, the database exists, but doesn't have tables. If I do cat dump.sql | kubectl exec -t postgres -- psql -U postgres -d postgres works just fine.

The same construction works in docker with tables lost, but I can add sleep 60 between creating container and loading dump this work carrefully. can I add sleep between creating pod in k8s and loading dump from pv?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.