IngressRouteUDP
IngressRouteUDP
is the CRD implementation of a Traefik UDP router.
Before creating IngressRouteUDP
objects, you need to apply the Traefik Kubernetes CRDs to your Kubernetes cluster.
This registers the IngressRouteUDP
kind and other Traefik-specific resources.
Configuration Examples
- IngressRouteUDP
apiVersion: traefik.io/v1alpha1
kind: IngressRouteUDP
metadata:
name: ingressrouteudpfoo
namespace: apps
spec:
entryPoints:
- fooudp # The entry point where Traefik Hub listens for incoming traffic
routes:
- services:
- name: foo # The name of the Kubernetes Service to route to
port: 8080
weight: 10
nativeLB: true # Enables native load balancing between pods
nodePortLB: true
Configuration Options
Field | Description | Default | Required |
---|---|---|---|
entryPoints | List of entrypoints names | No | |
routes | List of routes | Yes | |
routes[n].services | List of Kubernetes service definitions (See below for ExternalName Service setup) | No | |
services[n].name | Defines the name of a Kubernetes service | "" | Yes |
routes[n].services[n].port | Defines the port of a Kubernetes service. This can be a reference to a named port. | "" | No |
routes[n].services[n].weight | Defines the weight to apply to the server load balancing | "" | No |
routes[n].services[n].nativeLB | Controls, when creating the load-balancer, whether the LB's children are directly the pods IPs or if the only child is the Kubernetes Service clusterIP. | false | No |
routes[n].services[n].nodePortLB | Controls, when creating the load-balancer, whether the LB's children are directly the nodes internal IPs using the nodePort when the service type is | false | No |
routes.services
ExternalName Service
ExternalName Services are used to reference services that exist off platform, on other clusters, or locally.
Port Definition
Traefik Hub connect to a backend with a domain and a port. However, Kubernetes ExternalName
Service can be defined without any port.
Accordingly, Traefik supports defining a port in two ways:
- only on
IngressRouteUDP
service - on both sides, you'll be warned if the ports don't match, and the
IngressRouteUDP
service port is used
Thus, in case of two sides port definition, Traefik expects a match between ports.
- Port defined on the Resource
- Port defined on the Service
- Port defined on both sides
- IngressRouteUDP
- Service ExternalName
apiVersion: traefik.io/v1alpha1
kind: IngressRouteUDP
metadata:
name: test.route
namespace: default
spec:
entryPoints:
- foo
routes:
- services:
- name: external-svc
port: 80
apiVersion: v1
kind: Service
metadata:
name: external-svc
namespace: default
spec:
externalName: external.domain
type: ExternalName
- IngressRouteUDP
- Service ExternalName
apiVersion: traefik.io/v1alpha1
kind: IngressRouteUDP
metadata:
name: test.route
namespace: default
spec:
entryPoints:
- foo
routes:
- services:
- name: external-svc
apiVersion: v1
kind: Service
metadata:
name: external-svc
namespace: default
spec:
externalName: external.domain
type: ExternalName
ports:
- port: 80
- IngressRouteUDP
- Service ExternalName
apiVersion: traefik.io/v1alpha1
kind: IngressRouteUDP
metadata:
name: test.route
namespace: default
spec:
entryPoints:
- foo
routes:
- services:
- name: external-svc
port: 80
apiVersion: v1
kind: Service
metadata:
name: external-svc
namespace: apps
spec:
externalName: external.domain
type: ExternalName
ports:
- port: 80
routes.services.nodePortLB
To avoid creating the server load-balancer with the pods IPs and use Kubernetes Service clusterIP
directly, one should set the UDP service NativeLB
option to true. By default, NativeLB
is false.
- IngressRouteUDP
- Service
apiVersion: traefik.io/v1alpha1
kind: IngressRouteUDP
metadata:
name: test.route
namespace: default
spec:
entryPoints:
- foo
routes:
- services:
- name: svc
port: 80
# Here, nativeLB instructs to build the servers load balancer with the Kubernetes Service clusterIP only.
nativeLB: true
apiVersion: v1
kind: Service
metadata:
name: svc
namespace: default
spec:
type: ClusterIP
...
Related Content
- Learn about
IngresRoute
in its dedication section - Learn about
IngressRouteTCP
in its dedication section