访问Kubernetes仪表板 [英] Accessing Kubernetes Dashboard

查看:82
本文介绍了访问Kubernetes仪表板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I can access kubernetes dashboard when run kubectl proxy --port=8001 and able to sign in with the token that ı recieved from secret.

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

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

But when I expose my application via ingress I can also access the UI but I can not sign in with the token that ı can sign in for local. I am struggling to resolve this issue any help will be appreciated.

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

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

curl -v http://..../ -H "" Output

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

推荐答案

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

When I expose my application via ingress I can also access the UI but I can not sign in with the token that I can sign in for local.

根据 Kubernetes Dashboard 文档,自1.7.x版(2017)起,您仍然可以通过HTTP

According to Kubernetes Dashboard documentation, since version 1.7.x (2017) you can still access dashboard via HTTP the same way older versions does when doing with localhost.

但是当您选择公开它时:

But when you choose to expose it:

仪表板不应通过HTTP公开公开.对于通过HTTP访问的域,将无法登录.单击登录页面上的登录"按钮后,什么也不会发生.

Dashboard should not be exposed publicly over HTTP. For domains accessed over HTTP it will not be possible to sign in. Nothing will happen after clicking Sign in button on login page.

为了公开您的仪表板,您需要配置HTTPS访问.您在评论中提到您正在内部部署Kubernetes,并且希望通过NodeIP访问仪表板.

In order to expose your dashboard you need to configure HTTPS access. You mentioned in the comments you are running Kubernetes On Premise and that you wish to access the dashboard via NodeIP.

在这种情况下,请遵循:

In this case follow: Accessing Dashboard via NodePort.

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

Remember that instead of accessing https://<master-ip>:<nodePort> you should access https://<node-ip>:<nodePort> of the node which dashboard is installed.

如果您有任何疑问,请在评论中告诉我,我会帮助您.

If you have any doubts let me know in the comments and I'll help you.

这篇关于访问Kubernetes仪表板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆