0

在此处报告解决方案以供将来参考,因为在实施此操作时找不到任何单一资源:

使用nginxinc/kubernetes-ingress控制器而不是kubernetes/ingress-nginx

问题始于portainer v2.1.1,但如果您需要创建入口规则并传递标头,或应用任何特定规则。

问题代码:

Unable to upgrade the connection (err=websocket: the client is not using the websocket protocol: 'upgrade' token not found in 'Connection' header) (code=500)

WebSocket connection to 'ws://portainer.example.com/.....// failed
4

1 回答 1

1

按照Nginx websocket 代理指南 使用Nginx 片段的最小解决方案:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: portainer-ingress
  namespace: portainer
  annotations:
    nginx.org/location-snippets: |
      proxy_set_header   Upgrade            $http_upgrade;
      proxy_set_header   Connection         "upgrade";
    
spec:
  ingressClassName: nginx
  rules:
    -  host: portainer.example.com
       http:
        paths:
          - path: /
            backend:
              service:
                name: portainer
                port:
                  number: 9000
            pathType: Prefix

运行使用清单安装的Nginx 入口控制器版本 v1.10.1

helm.sh/chart: ingress-nginx-3.23.0
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/version: 0.44.0

我希望这可以帮助某人作为参考

于 2021-03-19T15:57:11.170 回答