Blog

How to configure UDP services with Kong API Gateway

Mark van Holsteijn

Updated April 30, 2025
2 minutes

Since version 2.2 Kong API Gateway supports UDP services, but the documentation illustrates this with a very complex Kubernetes setup. In this blog I will show you the easiest way to configure a udp service. Without further ado: to configure a UDP service in Kong, you just have to do three things:

  1. define a Kong service with the udp protocol
  2. define a Kong route with the udp protocol
  3. configure Kong to listen on UDP In this setup, I will configure the Google DNS nameservers as a udp service and route traffic from localport 5353.

define kong udp service

To define the kong UDP service, type:

$ curl -sS --fail 
     -X POST http://localhost:8001/services 
     -d name=google-dns 
     -d protocol=udp 
     -d host=8.8.8.8 
     -d port=53

define kong udp route

To define the kong UDP route to the service, type:

curl -sS --fail  
     -X POST http://localhost:8001/services/google-dns/routes 
     -H 'Content-Type: application/json' 
     -d '{"protocols": [ "udp"], "destinations": [{"port": 5353}]}'

configure Kong to listen on UDP

To configure Kong to listen on UDP, start kong with the property stream_listen set:

KONG_STREAM_LISTEN="0.0.0.0:5353 udp" kong ...

Bonus enable logging

The enable logging of udp requests, make you configure the udp protocol on the plugin too.

curl -sS --fail 
    -X POST http://localhost:8001/plugins 
    --data name=file-log 
    --data protocols=udp 
    --data protocols=http 
    --data protocols=https 
    --data config.path=/tmp/request.log

conclusion

The guide on Using UDP in Kong is more a guide into the complexity of kubernetes. In this blog, I showed you how easy it really is! Image by Gerd Altmann from Pixabay

Written by

Mark van Holsteijn

Mark van Holsteijn is a senior software systems architect at Xebia Cloud-native solutions. He is passionate about removing waste in the software delivery process and keeping things clear and simple.

Our Ideas

Explore More Blogs

View All

Puneet Pathak


Link testing

Link testing

Anna Małek