Generally, what I do is, if it is tcp traffic, I create a virtualservice listening to the tcp gateway and route it to the correct host. like so -
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
creationTimestamp: "2024-03-19T17:17:44Z"
generation: 2
name: tcp-test-virtual-service
namespace: default
resourceVersion: "1076485"
uid: 9cc94534-2dec-4165-8dec-4a8fb66087ea
spec:
gateways:
- tcp-test
hosts:
- '*'
tcp:
- match:
- port: 2057
route:
- destination:
host: tcp-test
port:
number: 2057
But The virtualservice resource in k8s does not allow
spec:
udp:
It returns this error -
denied the request: configuration is invalid: http, tcp or tls must be provided in virtual service
How can I direct incoming traffic on my UDP gateway?
Based on this link that is posted in stackoverflow UDP is not supported in istio. However from the same link it was mentioned from one of the answers that there will be an update wherein UDP protocol will be supported.
However, upon checking the documentation of istio VirtualService it seems that there is still no configuration for UDP ports.
But upon searching for this concern I bump into this documentation titled “Exposing TCP and UDP based services in Istio - The Easy Way” Based from the documentation wherein the scenario is there is already a service created and they edit it and add TCP. But it was indicated that it can also do UDP ports.
From the example
As you can see from the comment with # it was mentioned that it could also change to UDP for UDP service. For this concern make sure that your service is exposing UDP ports.