Running Websocket app on Kubernetes
In this article we will talk about steps required to run application which uses persistence connection. We will be using Google Cloud Kubernetes service for the code examples. We will be using the OpenAVStream websocket app for this article. Also make sure that you have read the official google document for websocket
A little about websocket vs http
Most of us might have experience running http service in cloud. Websockets are different from http as they are persistent connection. The advantage of a persistent connection is the client can send the data to the server and server can also push information to the client. Hence it is often used when information needs to be pushed from server. For example chat applications, Streaming data from server etc.
Deployment
Here we are assuming the you have already build your docker container and pushed it to gcr. The OpenAVStream repository which we are using already has a docker container so you just have to build and push the image to gcr.
Backend Config
The key difference from an http server is telling the ingress controller to not terminate the http connection. Remember websocket is an http request with upgrade header. Below is the configuration
Service Config
The backend service which is exposed to the ingress.
Ingress Config
Ingress configuration
For questions/more details write to us hello@k8scale.io