1

I'm trying to route incoming traffic into specific pods inside Kubernetes: As suggested here: Is it possible to specific custom rules for running new containers in Kubernetes/Docker?

I tried to use Ingress. Unfortunetly it seems to work only with http and I need to route traffic incoming from UDP.

Using config map I can't map specific URLs to specific services.

Any ideas on how to handle it ?

Łukasz Baran
  • 1,229
  • 3
  • 24
  • 47

2 Answers2

3

Ingress is for HTTP traffic so you're right to say that it cannot meet your needs.

The best way to do this is to use a Service. A Service performs automatic Layer 3 load-balancing across the Pods tagged to it. It will look something like this:

kind: Service
apiVersion: v1
metadata:
  name: ntp-service
spec:
  selector:
    app: ntp
  ports:
  - protocol: UDP
    port: 123
    targetPort: 123

The disadvantage to this method is that every worker node has to dedicate a port (123 in the above example) to the Service.

Eugene Chow
  • 1,688
  • 1
  • 11
  • 18
0

UDP is definitely supported in K8S:

Check out these articles for additional info:

Tommy Falgout
  • 76
  • 1
  • 3
  • Both of them expose service to internet trough Load Balancer (in this case Azure). And that part works. What doesn't work, is that I can't route UDP traffic internally. Once gateway get it, it is not routed to internal services. It's not really possiblt to expose everything trough LoadBalancer, so I want to only expose single service and route traffic to possibly hundreds of internal UDP services. – Łukasz Baran Aug 23 '17 at 23:14
  • 1
    Did you find a solution for this? I am also looking for examples of Ingress specifications that load-balance UDP protocol, and forwarding the traffic to the Kubernetes Service (by specifying serviceName and servicePort) that listens in on UDP port. The link to the Microsoft site above describes an example UDP service, but no Ingress specification. – rpkrpk Apr 11 '18 at 23:23