<p>I use Azure Kubernetes to host a couple of different services.</p>

<p>I'm trying to configure UDP load balancing over external IP.
I have created service with type LoadBalancer, UDP protocol and sessionAffinity. Also my deployment has configured HTTP RedinessProbe.</p>

<p>If UDP client reach my service from kubernetes network every thing works fine:
- client have sticky session to concrete pod in ready state.
- client re-balanced to another ready pod if already assigned pod was dead;
- client re-balanced after <strong>sessionAffinityConfig.clientIP.timeoutSeconds</strong> is elapsed(i.e next packets may be routed to other ready pod).</p>

<p>Thinks go different if I try to connect to LoadBalancer externally(using external IP):
- client have sticky session to concrete pod in ready state.
- client doesn't get new ready pod if previous was dead. It connected to new pod only in case If client stop to send messages during <strong>sessionAffinityConfig.clientIP.timeoutSeconds</strong> period of time.</p>

<p>So to solve it I tried to use ingress-nginx. I found useful article <a href="https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/exposing-tcp-udp-services.md" rel="nofollow noreferrer">here </a> about this kind of configuration.</p>

<p>But after I completed with udp-service configuration and adding UDP port I get following error:</p>

<blockquote>
  <p>cannot create an external load balancer with mix protocols</p>
</blockquote>

<p>Could You please point me how to do it properly in Kubernetes.</p>

<p>udp-services config map:</p>

<pre><code>kind: ConfigMap
apiVersion: v1
metadata:
  name: udp-services
  namespace: ingress-nginx
  labels:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
data:
  5684: "dev/dip-dc:5684"

</code></pre>

<p>ingress-nginx controller service YAML:</p>

<pre><code>kind: Service
apiVersion: v1
metadata:
name: ingress-nginx2
namespace: ingress-nginx
labels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
spec:
externalTrafficPolicy: Local
type: LoadBalancer
selector:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
ports:
- name: http
port: 80
targetPort: http
- name: https
port: 443
targetPort: https
- name: upd
port: 5684
targetPort: udp
</code></pre>

<p>A multi-protocol LB service is unfortunately not supported in many K8S providers. </p>

<p>Check out this <a href="https://medium.com/asl19-developers/build-your-own-cloud-agnostic-tcp-udp-loadbalancer-for-your-kubernetes-apps-3959335f4ec3" rel="nofollow noreferrer"><strong>tutorial</strong></a> that shows you how to build your own UDP/TCP load balancer.</p>

<p>The summary of what you will need to do is:</p>

<ol>
<li>Create a NodePort service for your application</li>
<li>Create a small server instance and run Nginx with LB config</li>
</ol>
