无法通过Kubernetes入口访问WebSocket可能是由于多种原因导致的。以下是一些建议和解决方案:
default
命名空间中,入口规则应该与之匹配:apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: websocket-ingress
namespace: default
spec:
rules:
- host: yourdomain.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: websocket-service
port:
number: 80
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: websocket-ingress
namespace: default
spec:
tls:
- hosts:
- yourdomain.com
secretName: your-tls-secret
rules:
- host: yourdomain.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: websocket-service
port:
number: 443
领取专属 10元无门槛券
手把手带您无忧上云