<p>I have many tenants running on one Kubernetes cluster (on AWS), where every tenant has one Pod that exposes one <strong>TCP</strong> port (<strong>not HTTP</strong>) and one <strong>UDP</strong> port.</p>

<ul>
<li>I don't need load balancing capabilities.</li>
<li>The approach should expose an IP address that is externally available with a dedicated port for each tenant</li>
<li>I don't want to expose the nodes directly to the internet</li>
</ul>

<p>I have the following service so far:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: my-service
  labels:
    app: my-app
spec:
  type: NodePort
  ports:
    - port: 8111
      targetPort: 8111
      protocol: UDP
      name: my-udp
    - port: 8222
      targetPort: 8222
      protocol: TCP
      name: my-tcp
  selector:
    app: my-app
</code></pre>

<p>What is the way to go?</p>

mitchkman
<ul>
<li><a href="https://medium.com/kokster/how-to-setup-nginx-ingress-controller-on-aws-clusters-7bd244278509" rel="nofollow noreferrer">Deploy</a> a NGINX ingress controller on your AWS cluster</li>
<li>Change your service my-service type from <code>NodePort</code> to <code>ClusterIP</code></li>
<li>Edit the configMap <code>tcp-services</code> in the <code>ingress-nginx</code> namespace adding :</li>
</ul>

<blockquote>
<pre><code>data:
  "8222": your-namespace/my-service:8222
</code></pre>
</blockquote>

<ul>
<li>Same for configMap <code>udp-services</code> :</li>
</ul>

<blockquote>
<pre><code>data:
  "8111": your-namespace/my-service:8111
</code></pre>
</blockquote>

<p>Now, you can access your application externally using the nginx-controller IP <code>&lt;ip:8222&gt;</code> (TCP) and <code>&lt;ip:8111&gt;</code> (UDP)</p>
