Websockets with Replicated Embedded Kubernetes


#1

Replicated Embedded Kubernetes is bundled with the Contour Ingress controller. To enable websocket support, you’ll have to use an IngressRoute rather than an Ingress. Note that IngressRoutes require a fully qualified domain name in virtualhost.fqdn, an IP address is not supported.

---
#kind: scheduler-kubernetes
apiVersion: contour.heptio.com/v1beta1
kind: IngressRoute
metadata:
  name: websockets
spec:
  virtualhost:
    fqdn: websockets.example.com
  routes:
    - match: /
      enableWebsockets: true
      services:
        - name: websockets
          port: 8010
          
---
#kind: scheduler-kubernetes
apiVersion: v1
kind: Service
metadata:
  name: websockets
  labels:
    app: websockets
spec:
  ports:
  - port: 8010
    targetPort: 8010
  selector:
    app: websockets

---
#kind: scheduler-kubernetes
apiVersion: apps/v1
kind: Deployment
metadata:
  name: websockets
  labels:
    app: websockets
spec:
  replicas: 1
  selector:
    matchLabels:
      app: websockets
  template:
    metadata:
      labels:
        app: websockets
    spec:
      containers:
      - name: websockets
        image: ksdn117/web-socket-test:latest