【问题标题】:Accessing Kubernetes Dashboard访问 Kubernetes 仪表板
【发布时间】:2020-06-02 12:03:35
【问题描述】:

我可以在运行 kubectl proxy --port=8001 时访问 kubernetes 仪表板,并且能够使用我从秘密收到的令牌登录。

http://localhost:8001/api/v1/namespaces/prod/services/http:kubernetes-dashboard:http/proxy/#/about?namespace=default

但是当我通过入口公开我的应用程序时,我也可以访问 UI,但我无法使用我可以登录本地的令牌登录。我正在努力解决这个问题,任何帮助将不胜感激。

{
 "jweToken": "",
 "errors": [
  {
   "ErrStatus": {
    "metadata": {},
    "status": "Failure",
    "message": "MSG_LOGIN_UNAUTHORIZED_ERROR",
    "reason": "Unauthorized",
    "code": 401
   }
  }
 ]
}

curl -v http://..../ -H "" 输出

< HTTP/1.1 200 OK
< Accept-Ranges: bytes
< Cache-Control: no-store
< Content-Type: text/html; charset=utf-8
< Date: Tue, 18 Feb 2020 14:28:28 GMT
< Last-Modified: Fri, 07 Feb 2020 13:15:14 GMT
< Vary: Accept-Encoding
< Content-Length: 1262
< 
<!--
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.
-->

入口日志

8T14:21:42Z"}
{"level":"warning","msg":"Endpoints not available for prod/kubernetes-dashboard","time":"2020-02-18T14:21:42Z"}
{"level":"warning","msg":"Endpoints not available for prod/kubernetes-dashboard","time":"2020-02-18T14:21:43Z"}
{"level":"warning","msg":"Endpoints not available for prod/kubernetes-

【问题讨论】:

  • 您得到什么具体错误?是 nginx 还是其他一些入口?您能否为仪表板提供入口 yaml 以及为仪表板提供服务 yaml?您是使用 http 还是 https 访问?
  • @ArghyaSadhu,我在我的问题中添加了
  • 您使用的是什么浏览器?您是否尝试过其他浏览器?你试过用令牌卷曲吗?
  • 嗨,是的,我尝试了 chrome 和 safari.. 是的,我也添加了输出
  • 我正在尝试重现您的环境以帮助您,完成后我会立即联系。

标签: kubernetes kubernetes-dashboard


【解决方案1】:

当我通过入口公开我的应用程序时,我也可以访问 UI,但我无法使用可以登录本地的令牌登录。

根据Kubernetes Dashboard 文档,从版本 1.7.x (2017) 开始,您仍然可以通过 HTTP 访问仪表板,方式与使用 localhost 时older versions does 相同。

但是当你选择公开它时:

仪表板不应通过 HTTP 公开。对于通过 HTTP 访问的域,将无法登录。单击登录页面上的登录按钮后不会发生任何事情。

为了公开您的仪表板,您需要配置 HTTPS 访问。 您在 cmets 中提到您正在运行 Kubernetes On Premise,并且您希望通过 NodeIP 访问仪表板。

在这种情况下,请关注:Accessing Dashboard via NodePort

请记住,您应该访问安装仪表板的节点的https://&lt;node-ip&gt;:&lt;nodePort&gt;,而不是访问https://&lt;master-ip&gt;:&lt;nodePort&gt;

如果您有任何疑问,请在 cmets 中告诉我,我会为您提供帮助。

【讨论】:

  • 我有机会试试你的指令。但是当我尝试通过 ingress 通过 https 访问时,它会引发 504 网关错误
猜你喜欢
  • 1970-01-01
  • 2016-12-08
  • 1970-01-01
  • 2016-09-14
  • 2019-05-08
  • 2018-11-03
  • 2020-01-23
  • 2019-06-22
相关资源
最近更新 更多