How to expose tcp port of kubernetes-nginx-ingress in DigitalOcean managed Kubernetes

I am following the below the guide

I also have deployed the nginx-ingress in kube-system namespace . These are the yamls files applied

apiVersion: v1
kind: ConfigMap
  name: tcp-nginx-rabbitmq
  namespace: kube-system
  15672: "default/rabbitmq:15672"

apiVersion: v1
kind: Service
    kompose.cmd: kompose convert --controller deployment -v -o DO-Kubernetes
    kompose.version: 1.21.0 (992df58d8)
  creationTimestamp: null
    io.kompose.service: rabbitmq
  name: rabbitmq
  - name: "15672"
    port: 15672
    targetPort: 15672
  - name: "5672"
    port: 5672
    targetPort: 5672
    io.kompose.service: rabbitmq
  loadBalancer: {}

apiVersion: v1
kind: Service
  annotations: |
      {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{"","":"Helm","":"ingress-nginx","":"0.35.0","":"Local","ports":[{"name":"http","port":80,"protocol":"TCP","targetPort":"http"},{"name":"https","port":443,"":"ingress-nginx","":"ingress-nginx"},"type":"LoadBalancer"}} <id> "true"
  creationTimestamp: "2020-09-26T04:51:57Z"
  labels: controller ingress-nginx Helm ingress-nginx 0.35.0 ingress-nginx-2.13.0
  name: ingress-nginx-controller
  namespace: kube-system
  resourceVersion: "11774380"
  selfLink: /api/v1/namespaces/kube-system/services/ingress-nginx-controller
  uid: <uid>
  externalTrafficPolicy: Local
  healthCheckNodePort: 30093
  - name: http
    nodePort: 30583
    port: 80
    protocol: TCP
    targetPort: http
  - name: https
    nodePort: 30628
    port: 443
    protocol: TCP
    targetPort: https
  - name: rabbitmq-tcp-15672
    nodePort: 31555
    port: 15672
    protocol: TCP
    targetPort: 15672
  selector: controller ingress-nginx ingress-nginx
  sessionAffinity: None
  type: LoadBalancer
- ip: <ip>

The service is up and I can see the starting logs of rabbitmq ….(no hits) . The tcp port is also open from the loadbalancer confirmed with nc -zv. Firefox is also giving me an error

Secure Connection failed 

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

@pistle2020 How to expose multiple services using this tcp.

let say

apiVersion: v1 kind: ConfigMap metadata: name: tcp-services namespace: ingress-nginx-private data: 5432: “demo/postgres:5432”

this will expose “postgres” service. if we have 10 services which need to expose same like about how can we achieve this?

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]

It is also possible to use a number or the name of the port. The two last fields are optional. Adding PROXY in either or both of the two last fields we can use Proxy Protocol decoding (listen) and/or encoding (proxy_pass) in a TCP service

The next example shows how to expose the service example-go running in the namespace default in the port 8080 using the port 9000

apiVersion: v1 kind: ConfigMap metadata: name: tcp-services namespace: ingress-nginx data: 9000: “default/example-go:8080” Since 1.9.13 NGINX provides UDP Load Balancing. The next example shows how to expose the service kube-dns running in the namespace kube-system in the port 53 using the port 53

apiVersion: v1 kind: ConfigMap metadata: name: udp-services namespace: ingress-nginx data: 53: “kube-system/kube-dns:53” If TCP/UDP proxy support is used, then those ports need to be exposed in the Service defined for the Ingress.

apiVersion: v1 kind: Service metadata: name: ingress-nginx namespace: ingress-nginx labels: ingress-nginx 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: ingress-nginx ingress-nginx