title: Problems on running a SIP application (UDP) on Kubernetes
body: <p>I am trying to work on a SIP application (opensips presence server) on Kubernetes but it's not working as expected.</p>
  
  <p>The application runs on UDP port 5060 and clients also use same port to connect.</p>
  
  <p>I have created a NodePort service(because LoadBalancer only supports TCP) which exposes NodePort 5060 and container port is also 5060.</p>
  
  <p>Below is the spec:</p>
  
  <pre><code>"spec": {
      "ports": [
        {
          "port": 5061,
          "protocol": "UDP",
          "targetPort": 5060,
      "nodeport": 5060,
      "name": "sipu"
        }
      ],
      "selector": {
        "app": "opensips"
      },
      "type": "NodePort"
    }
  </code></pre>
  
  <p>And the Iptable rules:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>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.</p>
  
  <p>I tried with different client port but in that case, the iptable ignores the port because it doesn't know about that port.</p>
  
  <p>Please guide me if something extra needs to be done in this case.</p>
  
  <p>Thanks</p>