<p>I'm trying to integrate socket.io into an application deployed on Google Kubernetes Engine.  Developing locally, everything works great. But once deployed, I am continuously getting the dreaded 400 response when my sockets try to connect on.  I've been searching on SO and other sites for a few days now and I haven't found anything that fixes my issue.</p>

<p>Unfortunately this architecture was set up by a developer who is no longer at our company, and I'm certainly not a Kubernetes or GKE expert, so I'm definitely not sure I've got everything set up correctly.</p>

<p>Here's out setup:</p>

<ul>
<li><p>we have 5 app pods that serve our application distributed across 5 cloud nodes (GCE vm instances)</p></li>
<li><p>we are using the nginx ingress controller (<a href="https://github.com/kubernetes/ingress-nginx" rel="nofollow noreferrer">https://github.com/kubernetes/ingress-nginx</a>) to create a load balancer to distribute traffic between our nodes</p></li>
</ul>

<p>Here's what I've tried so far:</p>

<ul>
<li>adding the following annotations to the ingress:</li>
</ul>

<p><code>nginx.ingress.kubernetes.io/affinity: "cookie"
nginx.ingress.kubernetes.io/session-cookie-hash: "sha1"
nginx.ingress.kubernetes.io/session-cookie-name: "route"</code></p>

<ul>
<li>adding <code>sessionAffinity: ClientIP</code> to the backend service referenced by the ingress</li>
</ul>

<p>These measures don't seem to have made any difference, I'm still getting a 400 response.  If anyone has handled a similar situation or has any advice to point me in the right direction I'd be very, very appreciative!  </p>

Josh Newsom
<p>I just setup ngin ingress with same config where we are using socket.io. </p>

<p>here is my ingress config</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: core-ingress
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.org/websocket-services : "app-test"
    nginx.ingress.kubernetes.io/rewrite-target: /
    certmanager.k8s.io/cluster-issuer: core-prod
    nginx.ingress.kubernetes.io/ssl-redirect: "true"
    nginx.ingress.kubernetes.io/secure-backends: "true"
    nginx.ingress.kubernetes.io/websocket-services : "socket-service"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "1800"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "1800"

spec:
  tls:
  - hosts:
    - &lt;domain&gt;
    secretName: core-prod
  rules:
  - host: &lt;domain&gt;
    http:
      paths:
      - backend:
          serviceName: service-name
          servicePort: 80
</code></pre>

<p>i was also facing same issue so added <code>proxy-send-timeout</code> and <code>proxy-read-timeout</code>. </p>
