I'm trying to log into a kubernetes dashboard with a token given to me by my organization, but the token does not work.

Duane Wolford 26 Reputation points
2020-10-14T14:58:41.177+00:00

So as stated, I can't get in to the dashboard. The first option is a token, the second option to get in is with a kubeconfig file. I want to use a token, but the one given to me doesn't work

Here are the commands I ran, which they said should work to get me in, but no matter what, the token they gave me is not working.

az aks get-credentials --resource-group rg-aks-nonprod-eastus-001 --name aks-nonprod-eastus-001 --admin -a

az account show (I verified that it is the correct Azure account)

kubectl port-forward -n kube-system service/kubernetes-dashboard 8080:443

Those above statements get me to the dashboard locally on 443, no problem. And the Azure configuration is verified, and I've already logged into azure using the CLI

C:\kubectl>kubectl config view
apiVersion: v1
clusters:

  • cluster:
    certificate-authority-data: DATA+OMITTED
    server: https://aks-nonprod-eastus-001-dns-a7d8ab13.hcp.eastus.azmk8s.io:443
    name: aks-nonprod-eastus-001
    contexts:
  • context:
    cluster: aks-nonprod-eastus-001
    user: clusterAdmin_rg-aks-nonprod-eastus-001_aks-nonprod-eastus-001
    name: aks-nonprod-eastus-001-admin
    current-context: aks-nonprod-eastus-001-admin
    kind: Config
    preferences: {}
    users:
  • name: clusterAdmin_rg-aks-nonprod-eastus-001_aks-nonprod-eastus-001
    user:
    client-certificate-data: REDACTED
    client-key-data: REDACTED
    token: REDACTED

Can someone help me with this? I need to get either the token I was given working (I think everybody is using the same one) or get a new one. I'd prefer to use the one I was given.

Thanks,

Duane

Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
2,186 questions
0 comments No comments
{count} votes

Accepted answer
  1. whoward-msft 2,766 Reputation points
    2020-10-15T00:59:42.943+00:00

    Hi @Duane Wolford ,

    Using powershell on your local system you can do:

    Store the credentials in kube config

    az aks get-credentials --resource-group rg-aks-nonprod-eastus-001 --name aks-nonprod-eastus-001 --admin -a

    Rip credential secret token from kube config

    kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | sls admin-user | ForEach-Object { $_ -Split '\s+' } | Select -First 1)

    Start local proxy

    kubectl proxy

    Open web browser to proxy url

    http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/

    Paste in the cred secret token you dumped earlier from kube config

    32408-image.png

    ---
    If this helps you solve your problem please mark this answer as accepted to help others with similar questions

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.