This is a sample application that demonstrates the use of an upgraded websockets connection on an ingress traffic when using Istio VirtualService
.
The app.yaml
creates a Kubernetes Service
and a Deployment
that is based on an existing Docker image for Hiroakis's Tornado Websocket Example.
Notice: The addition of websockets upgrade support in v1alpha3 routing rules has only been added after the release of Istio v0.8.0
.
Install Istio by following the Istio Quick Start.
-
First install the application service:
- With manual sidecar injection:
kubectl create -f <(istioctl kube-inject -f samples/websockets/app.yaml)
- With automatic sidecar injection
kubectl create -f samples/websockets/app.yaml
-
Create the Ingress
Gateway
andVirtualService
that enables the upgrade to Websocket for incoming traffic:kubectl create -f samples/websockets/route.yaml
-
Access http://$GATEWAY_IP/ with your browser
-
The
WebSocket status
should show a greenopen
status which means that a websocket connection to the server has been established. To see the websocket in action see the instructions in the REST API examples section of the demo app webpage for updating the server-side data and getting the updated data through the open websocket to the table in the webpage (without refreshing).
kubectl delete -f samples/websockets/route.yaml
kubectl delete -f samples/websockets/app.yaml