通过Ingress的Kubernetes仪表板

时间:2018-09-13 11:09:42

标签: kubernetes kubernetes-ingress kubernetes-dashboard

我有带有Ingress / Traefik控制器的Kubernetes集群

我还使用以下位置的标准配置安装了仪表板:https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml

我正在尝试通过Ingress访问信息中心,但出现404错误

404 page not found

我的ingress.yml文件如下

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: "traefik"
  name: app-ingress-system
  namespace: kube-system
spec:
  tls:
  - hosts:
    - dashboard.domain.com
    secretName: kubernetes-dashboard-certs
  rules:
  - host: dashboard.domain.com
    http:
      paths:
      - path: /
        backend:
          serviceName: kubernetes-dashboard
          servicePort: 443

我尝试了不同的方法-路径:(例如/ dashboard,/ proxy)相同的结果

1 个答案:

答案 0 :(得分:1)

发生这种情况是因为kubernetes-dashboard-certs没有traefik期望的文件tls.crttls.key。您应该在traefik日志中找到它。

下一个问题将出现在traefik证书和仪表板证书之间。我仍然不知道如何正确解决此问题,并使用以下选项配置traefik:

 ssl.insecureSkipVerify: "true"

最后一个是http端点不接受登录,然后最终我声明了将http重定向到https的入口:

kubectl apply -f - << EOF
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: dashboard.domain.com
      http:
        paths:
          - path: /
            backend:
              serviceName: kubernetes-dashboard
              servicePort: 443
EOF