【问题标题】:NginxInc/kubernetes-ingress - Opening portainer websocket connections - Passing headersNginxInc/kubernetes-ingress - 打开 portainer websocket 连接 - 传递标头
【发布时间】:2023-04-09 18:01:02
【问题描述】:

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

使用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

【问题讨论】:

  • 您好@Diarmuid,欢迎加入 Stack :) 为了提高知名度并帮助其他社区成员,发布问题和单独的答案将是有益的。然后,您将能够接受它以提高知名度。我还建议您熟悉您可以在此处找到的指南:stackoverflow.com/help

标签: kubernetes websocket kubernetes-ingress nginx-ingress portainer


【解决方案1】:

关注Nginx websocket proxying guide 使用Nginx snippets 的最小解决方案:

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

使用manifests安装运行Nginx ingress controller version 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

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

【讨论】:

    猜你喜欢
    • 2019-12-29
    • 1970-01-01
    • 1970-01-01
    • 2019-07-21
    • 1970-01-01
    • 2021-11-05
    • 1970-01-01
    • 2015-10-19
    • 1970-01-01
    相关资源
    最近更新 更多