I am trying to deploy Postgres on Bluemix Container service (Kubernetes)
I have created the Image and deployed it through the following yaml file:
apiVersion: v1
kind: Service
metadata:
  name: tripbru-postgres
  labels:
    app: tripbruREST
spec:
  ports:
    - port: 5432
      targetPort: 5432
      nodePort: 31432
  selector:
    app: tripbruREST
    tier: frontend
  type: NodePort
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: tripbru-postgres
  labels:
    app: tripbruREST
spec:
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: tripbruREST
        tier: postgres
    spec:
      containers:
      - image: registry.ng.bluemix.net/eliza/postgres:9.5
        name: postgres
        env:
        - name: POSTGRES_PASSWORD
          value: MYPASSWORD
        ports:
        - containerPort: 5432
          name: postgres
        volumeMounts:
        - name: pg-data
          mountPath: /var/lib/postgresql/data
        - name: tz-config
          mountPath: /etc/localtime
      volumes:
      - name: pg-data
        emptyDir: {}
      - name: tz-config
        hostPath:
          path: /usr/share/zoneinfo/Europe/Madrid
This effectively deploys it:
icordoba$ kubectl get services
NAME               CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
kubernetes         10.10.10.1     <none>        443/TCP          1d
tripbru-postgres   10.10.10.232   <nodes>       5432:31432/TCP   1d
But I can't connect to the node IP address on port 31432. I have tested Postgres is running using:
kubectl exec -it tripbru-postgres-3667814974-pzmsk bash
I get in the docker instance and check Postgres is running ok.
I am sure I am missing something. Do I need any other yaml file? Thanks.