# Exposing tcp services like Kafka, MongoDB, and Clickhouse using Nginx Ingress Controller 2026 guide 🔥

> Exposing tcp services like Kafka, MongoDB, and Clickhouse using Nginx Ingress Controller 2026 guide

Source: https://extim.su/blog/exposing-tcp-services-like-kafka-mongodb-and-clickhouse-using-nginx-ingress-controller-2026-guide-🔥/

<h3>🌟 Expose ports for database like a pro</h3>
<p>Ingress does not natively support TCP or UDP services, which can be a limitation for applications that require these types of connections. To work around this issue, the Ingress controller utilizes two specific flags: <code>--tcp-services-configmap</code> and <code>--udp-services-configmap</code>. These flags are configured to point to an existing ConfigMap, where the keys represent the external ports and the corresponding values define the services to expose. The required format for these entries is as follows: <code>&lt;namespace/service-name&gt;:&lt;service-port&gt;:[PROXY]:[PROXY]</code>. This structure allows for proper routing of TCP and UDP traffic.</p>
<p>If you've installed the NGINX Ingress controller using a Helm chart, you can simplify this process significantly. Instead of manually managing multiple services and ConfigMaps, you can specify the necessary configurations directly within the <code>values.yaml</code> file associated with the Helm chart. This approach helps streamline your deployment and configuration management. Here’s a step-by-step guide on how to implement these settings within your <code>values.yaml</code> file.</p>
<h3>🌝 A long story short</h3>
<p>Key parameters in values.yaml for the nginx-ingress-controller:</p>
<pre><code>controller:
  # for passing through traffic right
  config:
 use-forwarded-headers: &quot;true&quot;
 compute-full-forwarded-for: &quot;true&quot;
 use-proxy-protocol: &quot;false&quot;
# settings for tcp ports that we want to passing through
tcp:
&quot;9092&quot;: &quot;kafka/kafka:19092&quot;
&quot;27017&quot;: &quot;mongodb/mongo-rs-svc:27017&quot;
&quot;9000&quot;: &quot;clickhouse/clickhouse-cluster01:9000&quot;
</code></pre>
<p>In this example about <code>mongodb: &quot;27017&quot;: &quot;mongodb/mongo-rs-svc:27017&quot;</code>
<code>27017</code> - external port
<code>mongodb</code> - namespace
<code>mongo-rs-svc</code> - name of service
<code>mongo-rs-svc:27017</code> - service port</p>
<pre><code>kubectl get svc -n ingress-nginx
ingress-nginx-internal-controller           LoadBalancer   10.103.149.255   10.0.10.21              80:30425/TCP,443:32595/TCP,27017:32200/TCP,9000:31740/TCP,9092:32144/TCP
</code></pre>
<p>Here we can see new exposed ports for our services, and they are accessible by the IP address of the ingress controller:</p>
<pre><code>10.0.10.21:9092
10.0.10.21:27017
10.0.10.21:9000
</code></pre>
<h3>🎉 A recap</h3>
<p>Exposing tcp and udp services like database in Kubernetes using Nginx Ingress Controller is so easy, let's try it on your own and have a wonderful day!</p>

