<p>Deployed k8s on AWS with KOPS.
I have created nginx ingress <a href="https://github.com/kubernetes/ingress-nginx" rel="noreferrer">https://github.com/kubernetes/ingress-nginx</a>
nginx-ingress-controller image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.18.0</p>

<p>Everything is up and running and I could able to access applications externally using aws classic load balancer which is created by nginx service.</p>

<p>Recently we started working on websockets. I deployed my services in k8s and trying to access externally.</p>

<p>I created service and ingress for my application. Ingress is now pointing to loadbalancer(below json file).</p>

<p>I created route53 entry in aws and trying to connect to that but I am getting below error when I am trying to connect from my client application through chrome browser</p>

<blockquote>
  <p>WebSocket connection to 'wss://blockchain.aro/socket.io/?EIO=3&amp;transport=websocket' failed: Error during WebSocket handshake: Unexpected response code: 400</p>
</blockquote>

<p>I tried creating Application load balancer but I could not able to connect to <code>wss://&lt;host&gt;</code></p>

<p>Error:</p>

<blockquote>
  <p>WebSocket connection to
  'wss://blockchain.aro/socket.io/?EIO=3&amp;transport=websocket' failed:
  Error during WebSocket handshake: Unexpected response code: 400</p>
</blockquote>

<pre><code>const config: SocketIoConfig = { url: 'wss://blockchain.aro',
  options: { autoConnect: false, transports: ['websocket']} };


Ingress:

   "annotations": {
      "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"extensions/v1beta1\",\"kind\":\"Ingress\",\"metadata\":{\"annotations\":{},\"name\":\"blockchain\",\"namespace\":\"adapt\"},\"spec\":{\"rules\":[{\"host\":\"blockchain.aro\",\"http\":{\"paths\":[{\"backend\":{\"serviceName\":\"blockchain\",\"servicePort\":8097},\"path\":\"/\"},{\"backend\":{\"serviceName\":\"blockchain\",\"servicePort\":8097},\"path\":\"/socket.io\"},{\"backend\":{\"serviceName\":\"blockchain\",\"servicePort\":8097},\"path\":\"/ws/\"}]}}],\"tls\":[{\"hosts\":[\"blockchain.aro\"],\"secretName\":\"blockchain-tls-secret\"}]}}\n",
      "nginx.ingress.kubernetes.io/proxy-read-timeout": "3600",
      "nginx.ingress.kubernetes.io/proxy-send-timeout": "3600"
    }
</code></pre>

<p>included <code>tls</code> and <code>secretname</code> and <code>rules</code> in ingress file. I tried creating <code>ApplicationLoadbalancer</code> but I could not able to connect with that too.</p>

Ram
<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    certmanager.k8s.io/cluster-issuer: core-prod
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/proxy-read-timeout: "1800"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "1800"
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/secure-backends: "true"
    nginx.ingress.kubernetes.io/ssl-redirect: "true"
    nginx.ingress.kubernetes.io/websocket-services: core-service
    nginx.org/websocket-services: core-service
  name: core-ingress
spec:
  rules:
  - host: test.io
    http:
      paths:
      - backend:
          serviceName: core-service
          servicePort: 80
  tls:
  - hosts:
    - test.io
    secretName: core-prod
</code></pre>
