title: Cannot connect to remote postgreSQL database on Kubernetes cluster
body: <p>I'm currently setting up a postgres instance on my Kubernetes cluster hosted on OVH public cloud. The problem is that I can't access it. I know that I have to make <code>psql -h host -U user --password -p 30904 db</code> to connect, but the problem is that i don't know what to put instead of <strong>host</strong>. Localhost ? The ip of the master node ? Another ip ?</p>
  <p>Thank you for your time.</p>
  <p>postgres-deploy.yaml :</p>
  <pre><code>apiVersion: v1
  kind: Service
  metadata:
    name: postgres
  spec:
    type:
      NodePort
    ports:
    - port: 5432
    selector:
      app: postgres
  ---
  apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
  kind: Deployment
  metadata:
    name: postgres
  spec:
    selector:
      matchLabels:
        app: postgres
    strategy:
      type: Recreate
    template:
      metadata:
        labels:
          app: postgres
      spec:
        containers:
        - image: postgres:13.1
          name: postgres
          env:
              - name: POSTGRES_DB
                valueFrom:
                  secretKeyRef:
                    name: ident
                    key: POSTGRES_DB
            
                name: POSTGRES_USER
                valueFrom:
                  secretKeyRef:
                    name: ident
                    key: POSTGRES_USER
  
                name: POSTGRES_PASSWORD
                valueFrom:
                  secretKeyRef:
                    name: ident
                    key: POSTGRES_PASSWORD
          ports:
          - containerPort: 5432
            name: postgres
          volumeMounts:
          - name: postgres-persistent-storage
            mountPath: /var/lib/postgresql/data2
        volumes:
        - name: postgres-persistent-storage
          persistentVolumeClaim:
            claimName: postgres-pv-claim
  </code></pre>