-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot open TCP and UDP ports on same port number #6757
Comments
There is a bug in Kubernetes that makes it difficult to patch a Service to add a port on a new protocol, if that same port is already present in the Service. This is alluded to in the Traefik helm chart itself: https://github.com/traefik/traefik-helm-chart/blob/master/traefik/values.yaml#L592-L594
As a result of this bug, you'll need to delete and re-create the service if you want to add a UDP port that is already exposed as TCP. |
When performing the following:
Both ports now appear in the output for the traefik service. However, I still can't communicate over UDP. It seems like the packet gets lost "inside" k3s somewhere. |
How are you troubleshooting? Have you confirmed that the packet is not making it to traefik, or are packets not successfully going from traefik to the backend service? |
The pods outlined in the yaml file above are UDP and TCP echo servers. I have a client locally that can send and receive successfully when I separate the TCP and UDP port definitions. (8998/TCP and 8999/UDP). If there is a better way to investigate or provide info let me know. I am new to kubernetes, at the moment.
As I mentioned above, When I configure the proxy to use different ports for TCP and UDP, my test clients can connect, send and receive successfully. When I try to use the same port number for both protocols, my TCP client still works but my UDP client times out. |
RIght so where are you seeing the packets disappear in your tcpdump when things aren't working. Do they make it in to the Traefik pod? Do they make it from Traefik to the echo server pod? Or are you trying to connect directly to the service, and not through Traefik? I'm a bit confused as to what specifically you're testing and where things are getting lost. |
tcpdump from server host:
from pod at 10.42.0.10:
I don't see any matching packets in the traefik pod. There is one exception on a prior test, I got this output but haven't been able to recreate it:
TCP packets make it all the way to the TCP echo server. UDP packets don't appear to make it to the traefik pod, generally. I am trying to connect via the server node's IP address for TCP and UDP (so through traefik). |
I have successfully done this for HTTP3 support in #5184 (comment) so I know it does work. Have you checked both the traefik service and the traefik pod to confirm that the ports are defined there? I can't remember if the traefik chart automatically adds an entrypoint flag to the args, or if you need to do that yourself still? |
What commands should I use to verify the ports are defined? |
just use |
Ah, gotcha.
I guess the deployment is affected by the helm chart bug mentioned in your comment as well. Thanks for your help getting me sorted out! |
same here after reinstall by the helm, |
Environmental Info:
K3s Version:
Node(s) CPU architecture, OS, and Version:
Linux server1 6.1.4-1-default #1 SMP PREEMPT_DYNAMIC Mon Jan 9 11:00:31 UTC 2023 (4b9b43c) x86_64 x86_64 x86_64 GNU/Linux
Linux agent1 6.1.4-1-default #1 SMP PREEMPT_DYNAMIC Mon Jan 9 11:00:31 UTC 2023 (4b9b43c) x86_64 x86_64 x86_64 GNU/Linux
Linux agent2 6.1.0-1-default #1 SMP PREEMPT_DYNAMIC Wed Dec 21 16:29:21 UTC 2022 (ab10a11) x86_64 x86_64 x86_64 GNU/Linux
Cluster Configuration:
1 server, 2 agents
Describe the bug:
Trying to open a UDP port and TCP on the same port number doesn't work. It appears that only the TCP port is actually open.
Steps To Reproduce:
/var/lib/rancher/k3s/server/manifests/traefik-customizations.yaml
kubectl apply -f ./port-test.yaml
:Expected behavior:
Both the TCP and UDP pods should be reachable at
server1:8999
Actual behavior:
Only the TCP port works.
Additional context / logs:
kubectl
commands used remotely from Windows 10.The text was updated successfully, but these errors were encountered: