通过AWS ALB入口断开的kubernetes-dashboard

问题描述

我需要一些帮助,以使kubernetes-dashboard与AWS ALB入口一起正常工作。我已经使用kubernetes-dashboard成功部署了helm chart,并且通过kubectl proxykubectl port-forward访问时,一切正常。但是,通过AWS ALB访问时,我只有一个空白屏幕。

不确定是否与此有关,但是我注意到<body><kd-root>节在通过ALB访问时为空,但是在通过其他方法(也称为端口转发)访问时为非空。我想知道我是否缺少使这一切正常工作的一些关键配置参数。

<!--
Copyright 2017 The Kubernetes Authors.

Licensed under the Apache License,Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,software
distributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<!doctype html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <title>Kubernetes Dashboard</title>
  <link rel="icon"
        type="image/png"
        href="assets/images/kubernetes-logo.png" />
  <meta name="viewport"
        content="width=device-width">
<link rel="stylesheet" href="styles.c3ed2dcd657a389ecc4d.css"></head>

<body>
  <kd-root></kd-root>
<script src="runtime.6304db2809b97aa812ee.js" defer></script><script src="polyfills-es5.8f06d415489cadffc1de.js" nomodule defer></script><script src="polyfills.36db5820637aca3bd1e6.js" defer></script><script src="scripts.e296fd4cf14eea7ea0bd.js" defer></script><script src="main.17bd8ead409f8f047d6a.js" defer></script></body>

</html>

我正在使用

  • Kubernetes 1.18(AWS EKS)
  • kubernetes-dashboard 2.0.4
  • kubernetes-dashboard舵图2.8.1
  • chrome 85.0.4183.121
  • firefox 81.0.2

我正在使用NodePort服务。这是我的入口资源(由舵图创建)。

$ kc get ingress kubernetes-dashboard -o yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    alb.ingress.kubernetes.io/backend-protocol: HTTPS
    alb.ingress.kubernetes.io/healthcheck-path: /
    alb.ingress.kubernetes.io/healthcheck-protocol: HTTPS
    alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS": 443}]'
    alb.ingress.kubernetes.io/scheme: internal
    kubernetes.io/ingress.class: alb
    meta.helm.sh/release-name: kubernetes-dashboard
    meta.helm.sh/release-namespace: default
    nginx.ingress.kubernetes.io/backend-protocol: HTTPS
    service.alpha.kubernetes.io/app-protocols: '{"https":"HTTPS"}'
  creationTimestamp: "2020-10-13T21:45:48Z"
  generation: 1
  labels:
    app.kubernetes.io/instance: kubernetes-dashboard
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: kubernetes-dashboard
    app.kubernetes.io/version: 2.0.4
    helm.sh/chart: kubernetes-dashboard-2.8.1
  name: kubernetes-dashboard
  namespace: default
  resourceVersion: "21742506"
  selfLink: /apis/extensions/v1beta1/namespaces/default/ingresses/kubernetes-dashboard
  uid: bda0ce1d-b112-45db-9fa4-c220e3e0e691
spec:
  rules:
  - host: dashboard.my-domain.com
    http:
      paths:
      - backend:
          serviceName: kubernetes-dashboard
          servicePort: 443
        path: /
status:
  loadBalancer:
    ingress:
    - hostname: long-amazon-alb-url.us-east-1.elb.amazonaws.com

解决方法

没关系,我发现了问题。我将自己的ALB规则设置为仅允许/,而不是我真正想要的/*

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...