<p>I'm using &quot;Docker Desktop for Windows&quot; with kubernetes.  So far, its great.</p>
<p>I'd like to manage my postgress db (TCP:5432).  I'm using the kubernetes &quot;ingress-nginx&quot; ingress controller, which saws it can be <a href="https://kubernetes.github.io/ingress-nginx/user-guide/exposing-tcp-udp-services/" rel="nofollow noreferrer">configured to expose TCP using a configmap</a>.</p>
<p>Here is what I have so far:</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: tcp-services
  namespace: ingress-nginx
data:
  5432: &quot;ingress-nginx/postgres:5432&quot;

---
# SEE: https://kubernetes.io/docs/concepts/services-networking/ingress/

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-myproject.com
  annotations:
    kubernetes.io/ingress.class: nginx
    cert-manager.io/cluster-issuer: clusterissuer-selfsigned
    # See: https://github.com/kubernetes/ingress-nginx/blob/master/docs/examples/rewrite/README.md
    nginx.ingress.kubernetes.io/rewrite-target: /$2
    nginx.ingress.kubernetes.io/from-to-www-redirect: &quot;true&quot;
spec:
  tls:
  - hosts:
    - www.myproject.com
    secretName: tls-myproject
  rules:
  # Avoid Quasar build paths:  /css, /fonts, /icons, /js
  - http:
      paths:
        # See https://github.com/kubernetes/ingress-nginx/blob/master/docs/examples/rewrite/README.md
      - path: /data(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: backend
            port:
              number: 80
...
</code></pre>
<p>Now I need to:</p>
<ol>
<li>add the &quot;--tcp-services-configmap=&quot; argument</li>
<li>expose 5432 if 1) doesn't do this automatically.</li>
</ol>
<p>I found the ingress-nginx-controller in the kubernetes dashboard and hand edited like below, but it's behavior didn't change.</p>
<pre><code>spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/component: controller
      app.kubernetes.io/instance: ingress-nginx
      app.kubernetes.io/name: ingress-nginx
  template:
    metadata:
      creationTimestamp: null
      labels:
        app.kubernetes.io/component: controller
        app.kubernetes.io/instance: ingress-nginx
        app.kubernetes.io/name: ingress-nginx
    spec:
      volumes:
        - name: webhook-cert
          secret:
            secretName: ingress-nginx-admission
            defaultMode: 420
      containers:
        - name: controller
          image: &gt;-
            k8s.gcr.io/ingress-nginx/controller:v0.41.0@sha256:e6019e536cfb921afb99408d5292fa88b017c49dd29d05fc8dbc456aa770d590
          args:
            - /nginx-ingress-controller
            - '--publish-service=$(POD_NAMESPACE)/ingress-nginx-controller'
            - '--election-id=ingress-controller-leader'
            - '--ingress-class=nginx'
            - '--configmap=$(POD_NAMESPACE)/ingress-nginx-controller'
            - '--validating-webhook=:8443'
            - '--validating-webhook-certificate=/usr/local/certificates/cert'
            - '--validating-webhook-key=/usr/local/certificates/key'
            - '--tcp-services-configmap=ingress-nginx/tcp-services'
</code></pre>
<p>What am I missing?  How can I configure this w/o having to hand edit it?  Thank you!</p>

Michael Cole
<p>I think there are 2 issues.</p>
<ol>
<li><p>You need to install nginx separately from your postgress installation. This means that you will have some nginx pods/deployments, and a service that exist in the ingress-nginx namespace. To do this, follow the guide <a href="https://kubernetes.github.io/ingress-nginx/deploy" rel="nofollow noreferrer">here</a>. It is recommended that you follow a yaml file from the cloud section for a docker desktop deployment. <a href="https://github.com/docker/for-win/issues/7094" rel="nofollow noreferrer">This</a> is someone who has gone through the process.</p>
</li>
<li><p>Once nginx is installed on your cluster, you need to go from you postgress deployment/pod -&gt; service -&gt; ingress.  These will be in a different namespace than your ingress-nginx one (default is fine). To configure it, you can follow the guide located <a href="https://kubernetes.github.io/ingress-nginx/user-guide/basic-usage/" rel="nofollow noreferrer">here</a>. If you want to test things along the way, you can use kubernetes <code>port-forward</code>ing command to forward your postgress pod to your local machine. You can also test your service with the same method.</p>
</li>
</ol>
