Łukasz Baran
Łukasz Baran

Reputation: 1239

Kubernetes UDP load balancing services

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 ?

Upvotes: 1

Views: 5588

Answers (2)

Eugene Chow
Eugene Chow

Reputation: 1706

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.

Upvotes: 3

Related Questions