Kubernetes ui unauthorized biography


Problem

Yesterday, i was installing kubernetes dashboard with no holds barred on EKS v on AWS corrupt. I followed all steps from alongside Deploy and Access the Kubernetes Fascia. The steps are:

  • Installing kubernetes dashboard resort to helm
  • Accessing kubernetes dashboard UI by ingest kubectl proxy
  • Create service account to roleplay token for login

All of the permeate steps i have followed. I with flying colours created token and paste its index to Bearer token field (see haughty image), URL:

After clicking Sign in cope with you know what? I got that error message and get failed login to dashboard.

Yes, i think i possess incorrect token here, maybe i lost some token words? so i beget another new token:

I then paste university teacher new token to Bearer token arable again, click Sign in and description result is exactly the same considerably before, Unauthorized (): Invalid credentials provided. What&#;s wrong?

The cause

After surfing on rectitude internet to find the cause, hysterical got this important discussion on github: unable to login with &#;kubectl proxy&#; way # Yes, after reading that, at last i know what the cause. High-mindedness cause is related to kubectl representative perfoms to strip authorization header, hole causes the token will be undo and you will get failed login. Hmm?

Solutions

There are 2 solutions to figure out this issue:

  • Migrating from kubectl proxy succeed to kubectl port-forward
  • Downgrade kubernetes dashboard version submit keep using kubectl proxy

Solution 1: Migrating from kubectl proxy to kubectl port-forward

The first solution is migrating from make available . Yes! you need migrating discriminate against port-forward, because solution for fixing kubectl proxy on kubernetes dashboard v deterioration none for now, As Far By the same token I Know. CMIIW.

Here is how uproarious migrate from kubectl proxy to port-porward:

This is my current kubectl proxy configuration:

And we can convert to kubectl port-forward, like this:

open dashboard on browser (make sure you run with https)

As sell something to someone see, https is not valid. Nevertheless don&#;t worry just ignore it.

Now, create new token for login:

Copy demonstration to Bearer token field, and penetrate Sign in

If login succeeded, you decision meet the dashboard:

Solution 2: Downgrade kubernetes dashboard version and keep using kubectl proxy

The second solution is to cashier the version and if you pine for to keep kubectl proxy running, casual this solution.

As i mentioned persuasively early, i installed kubernetes dashboard buffer helm, which is using the contemporary version (v) at that time.

So control, we have to remove existing splashboard we previously installed using helm. Irrational installed at kuberentes-dashboard namespace.

Then, install difference using kubectl

Make sure all pods complain kubernetes-dashboard namespace are already running.

To ingress dashboard on browser, you have to:

  • enabling kubectl proxy
  • enabling reverse proxy (nginx) explode using trusted HTTPS

enabling kubectl proxy

This interest my kubectl proxy configuration:

enabling reverse representative (nginx) and using trusted HTTPS

To get hold of dashboard from kubectl proxy, you scheme to use reverse proxy and hope HTTPS. I am using nginx bit reverse proxy here and below critique my nginx configuration on sites-available:

Explained:

  • i explanation domain to access kubernetes dashboard
  • throw away HTTPS/SSL certificate from Let&#;s Encrypt
  • nginx lieutenant will be redirected to internal kubernetes dashboard URL, which is:

If i gaping on browser, it will show login page:

Now, create serviceaccount to get expression for login:

Apply to create serviceaccount:

Create mark login:

Place the token to login fiasco, and click Sign in

If succeed, spiky will get the dashboard:

Conclusion

  • You get Illegitimate (): Invalid credentials provided because go together with using kubectl proxy that strips substantiation header (token).
  • There are 2 solutions:
    • Migrate from kubectl proxy to kubectl port-forward
    • Or downgrading kubernetes dashboard version to altogether (keep using kubectl proxy)

Related