Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
384 views
in Technique[技术] by (71.8m points)

kubernetes - UDP socket client not able to communicate with UDP socket server on Minikube

I have deployed a UDP socket server on Minikube .Socket server is bound to port 2152 . Below is a snippet of IPs from describe pod command.

    Node:         minikube/192.168.49.2
    Start Time:   Thu, 07 Jan 2021 09:47:18 +0530
    Labels:       app=hello-app
    Annotations:  <none>
    Status:       Running
    IP:           172.17.0.3
 
    

My client , running on the same VM as minikube is not able to communicate with the server. I am using server address IP 172.17.0.3 and port as 2152 at client side . I also tried with minikube ip 192.168.49.2 to send UDP data from client to server.

Please help , what is wrong here.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Without providing information and context it is very hard to determine what could go wrong with your case. Minikube does simply many process and one of is to use ingress as way of exposing services.

Enabling ingress is very easy when using minikube. You just have to enable the addon:

minikube addons enable ingress

Since Ingress does not support TCP or UDP services you will to use flags for this reason this controller uses the flags --tcp-services-configmap and --udp-services-configmap to point to an existing config map where the key is the external port to use and the value indicates the service to expose using the format: <namespace/service name>:<service port>:[PROXY]:[PROXY]

Here`s an example of those service:

apiVersion: v1
kind: Service
metadata:
  name: my-service
  namespace: default
spec:
  selector:
    app: redis
  type: ClusterIP
  ports:
    - name: tcp-port
      port: 6379
      targetPort: 6379
      protocol: TCP

And this is the config map that points to that service:

apiVersion: v1
kind: ConfigMap
metadata:
  name: tcp-services
  namespace: ingress-nginx
data:
  6379 : "default/my-service:6379"

Where:

  • 6379 : the port your service should listen to from outside the minikube virtual machine
  • default : the namespace that your service is installed in
  • service : the name of the service

Similar config will be applied for the udp protocol:

apiVersion: v1
kind: ConfigMap
metadata:
  name: udp-services
  namespace: ingress-nginx
data:  
  53:  "kube-system/kube-dns:53"

Minikube documents has very good example if you wish to read more.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...