<p>I have deployed postgresql pod on kubernetes pod, and want to know how can I access postgresql gui. I am not able to access it with ingress path, as I got to know ingress are meant for https purpose only whereas postgres follows TCP protocol. Any lead how can I access through GUI?</p>
<p>deployment.yaml</p>
<pre><code>---
  apiVersion: &quot;apps/v1&quot;
  kind: &quot;Deployment&quot;
  metadata: 
    name: &quot;postgresql-development&quot;
    namespace: &quot;development&quot;
  spec: 
    selector: 
      matchLabels: 
        app: &quot;postgresql-development&quot;
    replicas: 1
    strategy: 
      type: &quot;RollingUpdate&quot;
      rollingUpdate: 
        maxSurge: 1
        maxUnavailable: 1
    minReadySeconds: 5
    template: 
      metadata: 
        labels: 
          app: &quot;postgresql-development&quot;
          tier: &quot;mysql&quot;
      spec: 
        containers: 
          - 
            name: &quot;postgresql-development&quot;
            image: &quot;postgresql:12.6&quot;
            imagePullPolicy: &quot;Always&quot;
            env: 
              - 
                name: &quot;POSTGRES_USER&quot;
                value: &quot;postgres&quot;
            ports: 
              - 
                containerPort: 5432
                name: &quot;postgres&quot;
                
            volumeMounts: 
              - 
                name: &quot;postgresql-persistent-storage&quot;
                mountPath: &quot;/var/lib/postgresql&quot;
                
        volumes: 
          - 
            name: &quot;postgresql-persistent-storage&quot;
            persistentVolumeClaim: 
              claimName: &quot;postgresql-pvc-development&quot;


                
        imagePullSecrets: 
          - 
            name: &quot;postgresql&quot;
</code></pre>
<p>service.yaml</p>
<pre><code>---
  apiVersion: &quot;v1&quot;
  kind: &quot;Service&quot;
  metadata: 
    name: &quot;postgresql-development&quot;
    namespace: &quot;development&quot;
    labels: 
      app: &quot;postgresql-development&quot;
      app.kubernetes.io/name: ingress-nginx
      app.kubernetes.io/part-of: ingress-nginx
  spec: 
    ports: 
      - 
        port: 59799
        targetPort: 5432
        protocol: TCP
    selector: 
      app: &quot;postgresql-development&quot;
      app.kubernetes.io/name: ingress-nginx
      app.kubernetes.io/part-of: ingress-nginx
      tier: mysql
</code></pre>
<p>ingress.yaml</p>
<pre><code>---
  apiVersion: &quot;networking.k8s.io/v1beta1&quot;
  kind: &quot;Ingress&quot;
  metadata: 
    name: &quot;postgresql-development-ingress&quot;
    namespace: &quot;development&quot;
    annotations: 
      nginx.ingress.kubernetes.io/rewrite-target: &quot;/$1&quot;
  spec: 
    rules: 
      - 
        host: &quot;localhost&quot;
        http: 
          paths: 
            - 
              backend: 
                serviceName: &quot;postgresql-development&quot;
                servicePort: 59799
              path: &quot;postgresql-development/(.*)&quot;
</code></pre>

SVD
<p>Ingress API are only for Layer 7 (HTTP). In your case you want to access Layer 4 (TCP).</p>
<p>To achieve you goal, you can:</p>
<ul>
<li>Use a <a href="https://kubernetes.io/docs/concepts/services-networking/service/#nodeport" rel="nofollow noreferrer">Nodeport</a> on your service</li>
<li>A Ingress Controller that handle TCP like <a href="https://doc.traefik.io/traefik/routing/providers/kubernetes-crd/#kind-ingressroutetcp" rel="nofollow noreferrer">Traefik</a> or <a href="https://kubernetes.github.io/ingress-nginx/user-guide/exposing-tcp-udp-services/" rel="nofollow noreferrer">Nginx</a></li>
<li>for local development, <a href="https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/" rel="nofollow noreferrer">Port Forward</a></li>
</ul>
