<p>I have multiple deployments which run pods which run TCP servers. These TCP servers listen all on port 9999</p>
<p>Currently each deployment has their own load balancer service, which results in a different IP for each deployment.</p>
<p>However I would like to have one IP address to expose the deployments and only distinguish by port.</p>
<p>So for example:</p>
<pre><code>&lt;public-ip&gt;:9001 -&gt; deployment 1
&lt;public-ip&gt;:9002 -&gt; deployment 2
&lt;public-ip&gt;:9003 -&gt; deployment 3
</code></pre>
<p>I have read about Ingress but the <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/#what-is-ingress" rel="nofollow noreferrer">docs</a> state that</p>
<blockquote>
<p>An Ingress does not expose arbitrary ports or protocols. Exposing services other than HTTP and HTTPS to the internet typically uses a service of type Service.Type=NodePort or Service.Type=LoadBalancer.</p>
</blockquote>
<p>So that seems to be not an option.</p>
<p>For context the kubernetes is hosted in azure in an vnet and only needs to be accessed from within this vnet.</p>

Ackdari
<p>Functionality ingress depends on the controller implementation that you are using. For example nginx ingress controller supports TCP/UDP proxy as documented <a href="https://kubernetes.github.io/ingress-nginx/user-guide/exposing-tcp-udp-services/#exposing-tcp-and-udp-services" rel="nofollow noreferrer">here</a></p>
<p>The next example shows how to expose the service example-go running in the namespace default in the port <code>8080</code> using the port <code>9000</code></p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: tcp-services
  namespace: ingress-nginx
data:
  9000: &quot;default/example-go:8080&quot;
</code></pre>
<p>If TCP/UDP proxy support is used, then those ports need to be exposed in the Service defined for the Ingress.</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: ingress-nginx
  namespace: ingress-nginx
  labels:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
spec:
  type: LoadBalancer
  ports:
    - name: http
      port: 80
      targetPort: 80
      protocol: TCP
    - name: https
      port: 443
      targetPort: 443
      protocol: TCP
    - name: proxied-tcp-9000
      port: 9000
      targetPort: 9000
      protocol: TCP
  selector:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
</code></pre>
