Problems on running a SIP application (UDP) on Kubernetes

三世轮回 提交于 2019-12-25 03:34:37

问题


I am trying to work on a SIP application (opensips presence server) on Kubernetes but it's not working as expected.

The application runs on UDP port 5060 and clients also use same port to connect.

I have created a NodePort service(because LoadBalancer only supports TCP) which exposes NodePort 5060 and container port is also 5060.

Below is the spec:

"spec": {
    "ports": [
      {
        "port": 5061,
        "protocol": "UDP",
        "targetPort": 5060,
    "nodeport": 5060,
    "name": "sipu"
      }
    ],
    "selector": {
      "app": "opensips"
    },
    "type": "NodePort"
  }

And the Iptable rules:

Chain KUBE-NODEPORT-CONTAINER (1 references)
 pkts bytes target     prot opt in     out     source               destination
   12  8622 REDIRECT   udp  --  *      *       0.0.0.0/0            0.0.0.0/0            /* default/opensips:sipu */ udp dpt:5060 redir ports 40482
    3    95 REDIRECT   udp  --  *      *       0.0.0.0/0            0.0.0.0/0            /* default/my-udp-service: */ udp dpt:6000 redir ports 47497


Chain KUBE-NODEPORT-HOST (1 references)
 pkts bytes target     prot opt in     out     source               destination
    0     0 DNAT       udp  --  *      *       0.0.0.0/0            0.0.0.0/0            /* default/opensips:sipu */ udp dpt:5060 to:10.0.1.215:40482
    0     0 DNAT       udp  --  *      *       0.0.0.0/0            0.0.0.0/0            /* default/my-udp-service: */ udp dpt:6000 to:10.0.1.215:47497

The application receives the request but the problem occurs when it tries to send the reply on port 5060, the reply is sent back to the pod, I guess because of the iptable rules.

I tried with different client port but in that case, the iptable ignores the port because it doesn't know about that port.

Please guide me if something extra needs to be done in this case.

Thanks


回答1:


maybe you need start kube-proxy service with this config flag on all nodes:

--udp-timeout=250ms (change the value according to your needs)

more info: http://kubernetes.io/v1.1/docs/admin/kube-proxy.html



来源:https://stackoverflow.com/questions/34455946/problems-on-running-a-sip-application-udp-on-kubernetes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!