Ingress Exposing TCP Services

content ai ingress exposing services
R
Rahul Yadav

Senior Email Marketing Strategist

 
June 30, 2025 2 min read

Ingress does not support TCP or UDP services. For this reason this Ingress controller uses the flags --tcp-services-configmap and --udp-services-configmap to point to an existing config map where the key is the external port to use and the value indicates the service to expose using the format: <namespace/service name>:<service port>:[PROXY]:[PROXY].

This guide describes how it can be achieved but doing this through your deployment chart is different.

Following guide assumes you have a fresh cluster with no NGINX Ingress installed.

Install NGINX Ingress using Helm

Follwing commands will install NGINX Ingress using Helm to the default namespace where nginx is being the release name and ingress-nginx/ingress-nginx is the repo.

Install helm 3

curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash

Add Ingress repo

helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx

Install NGINX Ingress on default namespace

helm repo update
helm install nginx ingress-nginx/ingress-nginx

Deploy your application

Here we are going to deploy an SMTP application and it's service to 587 port as ClusterIP type and then to expose it later using our ingress.
Remember to replace the <IMAGE> value below.

deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: smtp-chart
  labels:
    helm.sh/chart: chart-0.10.0
    app.kubernetes.io/name: chart
    app.kubernetes.io/instance: smtp
    app.kubernetes.io/version: "0.1.0"
    app.kubernetes.io/managed-by: Helm
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: chart
      app.kubernetes.io/instance: smtp
  template:
    metadata:
      labels:
        app.kubernetes.io/name: chart
        app.kubernetes.io/instance: smtp-develop
    spec:
      imagePullSecrets:
        - name: registry-secret
      containers:
        - name: chart
          image: "<IMAGE>"
          env: 
          imagePullPolicy: 
          ports:
            - containerPort: 587
              protocol: TCP
          livenessProbe:
            tcpSocket:
              port: 587
          readinessProbe:
            tcpSocket:
              port: 587

service.yaml

apiVersion: v1
kind: Service
metadata:
  name: smtp-chart
  labels:
    helm.sh/chart: chart-0.10.0
    app.kubernetes.io/name: chart
    app.kubernetes.io/instance: smtp
    app.kubernetes.io/version: "0.1.0"
    app.kubernetes.io/managed-by: Helm
spec:
  type: ClusterIP
  ports:
    - port: 587
      targetPort: 587
      protocol: TCP
      name: smtp
      nodePort: 
  selector:
    app.kubernetes.io/name: chart
    app.kubernetes.io/instance: smtp

Patch NGINX Ingress

Download the default values.yaml file for ingress-nginx.

change following:

tcp: {}
#  8080: "default/example-tcp-svc:9000"

to:

tcp:
  587: default/smtp-chart:587

Here default is the namespace of your TCP service or pod, and smtp-chart is the deployment name that we defined in the deployment.yaml
The following command will update you nginx controller, create the required config map and update config fields:

helm upgrade --install -n default nginx ingress-nginx/ingress-nginx --values values.yaml --wait

Check NGINX Ingress service

kubectl get svc -n default
NAME                                       TYPE           CLUSTER-IP       EXTERNAL-IP             PORT(S)                                    AGE
nginx-ingress-nginx-controller             LoadBalancer   10.100.106.248   a...elb.amazonaws.com   80:30918/TCP,443:32010/TCP,587:32516/TCP   12m
nginx-ingress-nginx-controller-admission   ClusterIP      10.100.7.167     <none>                  443/TCP                                    13d

In above output ingress is listening to port 587.

That's it!

You should be able to test it via telnet your ingress load balancer or external IP.

telnet a...elb.amazonaws.com 587
R
Rahul Yadav

Senior Email Marketing Strategist

 

Technical Manager and Passionate Fullstack and polyglot developer.

Related Articles

seo

6 Authentic Ways to Trace an IP Address from Email

Learn effective methods to trace IP addresses from emails for security verification, spam identification, and enhanced email management with practical step-by-step guidance.

By Abhijeet Chattarjee June 30, 2025 6 min read
Read full article
marketing

Demystifying Email Delivery: A Deep Dive into Email APIs, SMTP Servers, and Email Delivery Services

This blog post dives into the world of email APIs, SMTP servers, and email delivery services. Learn how they work together to get your emails into inboxes, not spam folders. Boost your email marketing results with this essential guide!

By Abhijeet Chattarjee June 30, 2025 7 min read
Read full article
content

21 SMTP Response Codes

The SMTP response code list can be used to help quickly determine the reason for email bounces or why you received an SMTP error when sending an email.

By Rahul Yadav June 30, 2025 6 min read
Read full article
digital

6 Tips for Defending Against Business Email Cybercriminal Attacks

Learn how to defend your firm from business email cybercriminal attacks, including how to spot and block them. Discover important tips with Mailazy now!

By Abhijeet Chattarjee June 30, 2025 6 min read
Read full article