Postgres on Kubernetes on IBM Bluemix containers
I solved it using "Pod" and not Deployment. I also changed hostPath and note the ephemeral "emptyDir" volume format (this is a test in free Kubernetes service by Bluemix so I can't use real volumes). This is the working yaml:
apiVersion: v1kind: Podmetadata: name: postgres labels: name: postgresspec: containers: - name: postgres image: registry.ng.bluemix.net/eliza/postgres:9.5 env: - name: POSTGRES_PASSWORD value: MYPASSWORD ports: - containerPort: 5432 volumeMounts: - name: pg-data mountPath: /var/lib/postgresql/data - name: tz-config mountPath: /etc/localtime volumes: - name: pg-data #emptyDir: {} hostPath: path: "/opt/tripbruPostgres" - name: tz-config hostPath: path: /usr/share/zoneinfo/Europe/Madrid
(Note I still don't know what was wrong with my "Deployment" approach, but using Pod works as I don't need replication at this stage)