Kubernetes UDP Ingress and Load Balancing Guide

Kubernetes manages UDP traffic primarily at Layer 4 of the OSI model rather than through traditional Layer 7 HTTP-based Ingress routing. While the standard Kubernetes Ingress resource is designed specifically for HTTP and HTTPS protocols, Kubernetes handles UDP load balancing and external access using native Service types, specialized Ingress controller stream features, the modern Gateway API, and internal routing managed by kube-proxy.

Layer 4 Kubernetes Services

The primary and most straightforward method for handling UDP traffic in Kubernetes is through a standard Service resource configured with protocol: UDP.

UDP Handling with Ingress Controllers

Standard Kubernetes Ingress resources only route HTTP/HTTPS traffic based on hostnames and paths. To bypass this limitation, several popular Ingress controllers provide custom Layer 4 streaming capabilities:

The Kubernetes Gateway API and UDPRoute

The Kubernetes Gateway API provides a modern, expressive replacement for the legacy Ingress resource. It natively incorporates Layer 4 protocols via the UDPRoute resource.

With UDPRoute, administrators can define a Gateway listener bound to the UDP protocol and attach route rules that direct UDP traffic to specific backend services. This approach standardizes UDP ingress without requiring controller-specific ConfigMaps or non-standard annotations.

Internal Routing and kube-proxy Behavior

Once UDP traffic arrives at a node, kube-proxy handles internal distribution to target pods using iptables or IPVS modes: