UDP send and receive in kubernetes

7/13/2018

For my project, I need to send UDP packets to a Kubernetes Pod from an outside cluster. How can I do this?

I am using Kubeadm for creating the cluster. I tried to use nodePort but it seems that my requirement cannot be fulfilled with Nodeport.

-- Ranjith Koova
kubectl
kubernetes
linux
minikube
ubuntu

2 Answers

7/17/2018

I am able to find the solution for my requirement.

I have exposed the UDP port for my pod and it works fine.

Example

kubectl expose pod udp-server-deployment-8c8d6d868-c77zx --port=10001 --protocol=UDP --external-ip=10.1.11.82 --name=udp-server

Thank you all for your support :)

-- Ranjith Koova
Source: StackOverflow

7/16/2018

Actually, NodePort can be used to expose ports within TCP and UDP protocols. What was the problem in your case?

You can consider using Nginx Ingress Controller and creating ReplicationController to implement Nginx ingress in order to expose your Pods across UDP port as described Here or you can check this Link.

Create ConfigMap and specify External port like <namespace/service name>:<service port> which you want to access from outside Kubernetes cluster.

Finally, Nginx ingress can be exposed, i.e., using Kubernetes ExternalIP.

-- mk_sta
Source: StackOverflow