1
votes

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

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

ingress logs

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-
1
What specific error you get ?is it nginx or some other ingress? Can you provide your ingress yaml for the dashboard and also the service yaml for dashboard? Are you accessing using http or https? - Arghya Sadhu
@ArghyaSadhu, I added in my question - semural
What browser you are using? Have you tried a different browser? Have you tried a curl with the token? - Arghya Sadhu
hi yes ı tried chrome and safari.. Yes ı added the output as well - semural
I'm trying to reproduce your environment in order to help you, as soon as I finish I reach out. - Will R.O.F.

1 Answers

1
votes

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.

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:

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.

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.

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.