0

I have a digital ocean kubernetes and an ingress controller routing traffic. but one of the pods needs to accept TCP traffic; so i would like to make the ingress to accept the TCP traffic and route to the pod. i followed this

https://minikube.sigs.k8s.io/docs/tutorials/nginx_tcp_udp_ingress/

and

https://kubernetes.github.io/ingress-nginx/user-guide/exposing-tcp-udp-services/

after following, i still cannot connect to the port.

Below is what i have:

Load. balancer:

kind: Service
apiVersion: v1
metadata:
  name:  ingress-nginx
  namespace: ingress-nginx
  labels:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
spec:
  selector:
    # app:  speed-transmission-app
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
  type:  LoadBalancer
  ports:
  - name: http
    port: 80
    targetPort: 80
    protocol: TCP
  - name: https
    port: 443
    targetPort: 443
    protocol: TCP
  - name:  transmission-port
    port:  9000
    targetPort:  8998
    protocol: TCP

config map


apiVersion: v1
kind: ConfigMap
metadata:
  name: tcp-services
  namespace: ingress-nginx
data:
  9000: "staging/speed-transmission-service:9000"

Now when i try to connect to the load balancer external IP at port 9000, i get connection lost.

I will really appreciate help on how to configure this. thanks.

  • I followed the tutorial and it worker out well. Did you [patch the ingress-nginx-contoller](https://minikube.sigs.k8s.io/docs/tutorials/nginx_tcp_udp_ingress/#patch-the-ingress-nginx-controller)? – moonkotte Oct 22 '21 at 10:48
  • I followed and it didnt work – Adebari Olalekan Oct 22 '21 at 11:31
  • Which `ingress-nginx` version do you use? How it was installed? I think I have an idea. This is most likely related to `deployment` set up and the fact that ingress doesn't use `configmaps`. Check [this answer](https://stackoverflow.com/questions/61430311/exposing-multiple-tcp-udp-services-using-a-single-loadbalancer-on-k8s), it should do the work. (when I tried first, on different cluster, it had already had this `arg` in deployment - `--tcp-services-configmap=$(POD_NAMESPACE)/tcp-services`) – moonkotte Oct 22 '21 at 12:38
  • i installed it directly from digital ocean as a one click app when i created the cluster – Adebari Olalekan Oct 22 '21 at 13:13
  • Good, have you tried what's described in the another answer above? It won't work out of the box. – moonkotte Oct 25 '21 at 08:04
  • Yea, it worked this answer [here](https://stackoverflow.com/questions/61430311/exposing-multiple-tcp-udp-services-using-a-single-loadbalancer-on-k8s) works but its a meticulous process and i will like to automate the process. it works and am using for now, but am still looking for a solution that could allow me to create a cluster and configure the tcp traffic along automatically. – Adebari Olalekan Nov 02 '21 at 00:43
  • If your problem is resolved, consider posting the answer and maybe ask a new question with your current problem. – kkopczak Nov 05 '21 at 17:58

1 Answers1

1

After searching everywhere for how to do this i came accross another stackoverflow answer that explain how this could work. it worked well and its what i still use now. the only issue is just that its not a long term solution as i usually have my loadbalancer goes down anytime any of the services that is listening on the tcp service goes down, thus affecting the whole cluster. this is however on DOKS, am not sure of how it will behave on another platform. here is the link to the answer. i will update this answer if i find a more stable solution.