8

我正在使用 k3s 的默认安装(版本 v1.17.0+k3s.1)并验证它在我的 Raspberry Pi 集群上正常工作。

使用推荐的说明( https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/ )安装 kubernetes-dashboard后,我在使用 k3s 将它暴露在集群之外后确认了它的工作原理基于 traefik 的负载均衡器。

但是,当我尝试使用 traefik 入口控制器公开它时,我无法连接到 kubernetes 仪表板,浏览器显示 HTTP 500 错误,即内部服务器错误。下面是我的入口 yaml 和 kubernetes-dashboard pod 日志,显示 TLS 证书错误。我相信证书错误是由于 traefik 不知道(和信任)kubernetes 仪表板使用的 TLS 证书。

一个。k8s-仪表板-入口

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  labels:
    k8s-app: kubernetes-dashboard
  name: kubernetes-dashboard
  namespace: kubernetes-dashboard
  annotations:
    kubernetes.io/ingress.class: traefik
    traefik.ingress.kubernetes.io/ssl-redirect: "true"
spec:
  rules:
    - host: k8s-services
      http:
        paths:
          - path: /k8s-dashboard
            backend:
              serviceName: kubernetes-dashboard
              servicePort: 443

笔记。域“k8s-services”域是在我的 pi 集群机器和浏览计算机主机文件中定义的。

湾。Kubernetes 仪表板 pod 日志

...
2020/01/18 06:04:19 Auto-generating certificates
2020/01/18 06:04:19 Metric client health check failed: the server is currently unable to handle the request (get services dashboard-metrics-scraper). Retrying in 30 seconds.
2020/01/18 06:04:19 Successfully created certificates
2020/01/18 06:04:19 Serving securely on HTTPS port: 8443
2020/01/18 06:04:49 Successful request to sidecar
2020/01/18 06:23:28 http: TLS handshake error from 10.42.0.113:52698: remote error: tls: bad certificate
2020/01/18 06:24:33 http: TLS handshake error from 10.42.0.113:52886: remote error: tls: bad certificate
2020/01/18 06:24:41 http: TLS handshake error from 10.42.0.113:52908: remote error: tls: bad certificate
2020/01/18 06:24:47 http: TLS handshake error from 10.42.0.113:52926: remote error: tls: bad certificate
2020/01/18 06:24:53 http: TLS handshake error from 10.42.0.113:52948: remote error: tls: bad certificate
2020/01/18 06:25:37 http: TLS handshake error from 10.42.0.113:53076: remote error: tls: bad certificate
2020/01/18 06:25:41 http: TLS handshake error from 10.42.0.113:53090: remote error: tls: bad certificate
2020/01/18 06:25:44 http: TLS handshake error from 10.42.0.113:53102: remote error: tls: bad certificate
2020/01/18 06:31:22 http: TLS handshake error from 10.42.0.113:54144: remote error: tls: bad certificate
2020/01/18 06:31:29 http: TLS handshake error from 10.42.0.113:54158: remote error: tls: bad certificate
...

我的问题似乎与以下 Stack Overflow 问题非常相似: Kubernetes dashboard through Ingress

我第一次尝试解决这个问题是将“ssl.insecureSkipVerify:'true'”添加到 k3s 中的 traefik.toml 文件中。不幸的是,我找不到全局 traefik.toml 文件(并且 traefik 似乎是使用 Helm Chart 安装的)。

请让我知道如何更新 traefik 中的“ssl.insecureSkipVerify”设置或其他替代解决方案。

4

1 回答 1

0

HelmChartConfig您需要在其下创建一个/var/lib/rancher/k3s/server/manifests/traefik-config.yaml内容:

apiVersion: helm.cattle.io/v1
kind: HelmChartConfig
metadata:
  name: traefik
  namespace: kube-system
spec:
spec:
  valuesContent: |-
    ssl.insecureSkipVerify: true    # <-- Add this line

但我怀疑它会解决问题。

于 2021-12-11T18:28:56.463 回答