Развертывание NotificationHub
Обновлено: 05.03.2024
NotificationHub — публичный сервис, используется для поддержки соединения клиента по веб-сокетам. Обязательно использование TLS.
Деплоймент:
apiVersion: apps/v1
kind: Deployment
metadata:
name: web-socket-deployment
namespace: timetta
labels:
appName: web-socket-deployment
spec:
replicas: 1
selector:
matchLabels:
appName: web-socket-app
template:
metadata:
labels:
appName: web-socket-app
spec:
containers:
- name: web-socket
image: cr.yandex/crpr8bvek949tq2fuqkf/web-socket-hub:latest
imagePullPolicy: "Always"
ports:
- protocol: TCP
containerPort: 5404
env:
- name: "ASPNETCORE_URLS"
value: "http://*:5404"
volumeMounts:
- mountPath: /app/secrets
name: app-settings
readOnly: true
volumes:
- name: app-settings
secret:
secretName: app-settings
imagePullSecrets:
- name: service-settings
Сервис и ingress-контроллер:
---
---
apiVersion: v1
kind: Service
metadata:
name: web-socket-service
namespace: onprem
spec:
selector:
appName: web-socket-app
ports:
- protocol: TCP
port: 80
targetPort: 5404
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: web-socket-ingress
namespace: onprem
annotations:
cert-manager.io/cluster-issuer: "letsencrypt"
nginx.ingress.kubernetes.io/proxy-buffer-size: "64k"
nginx.ingress.kubernetes.io/proxy-buffers-number: "8"
nginx.ingress.kubernetes.io/proxy-read-timeout: "360"
nginx.ingress.kubernetes.io/proxy-send-timeout: "360"
spec:
ingressClassName: "nginx"
tls:
- hosts:
- web-socket.your-domain
secretName: web-socket-tls
rules:
- host: web-socket.your-domain
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: web-socket-service
port:
number: 80