Starting point:

  • Docker for Mac with Kubernetes enabled

  • Kubernetes active

  • Install the Kubernetes dashboard

  • Access the dashboard and find this:

1

  • Try skipping - it doesn’t look right, it doesn’t seem right (who likes to “skip” challenges?)

  • Search the internet for over one hour - nothing

  • Finally I found the right command reading about serviceAccounts, here and here

The how to:

  • find your dashboard POD

      kubectl get pods --namespace=kube-system | grep dash
    
  • find the serviceAccount for this POD

      kubectl get pods --namespace=kube-system kubernetes-dashboard-845747bdd4-4wzlp -o yaml| grep -A 15 -B 15 serviceAccount
    
  • the output will look something like this:

    [...]
    dnsPolicy: ClusterFirst
    nodeName: docker-for-desktop
    restartPolicy: Always
    schedulerName: default-scheduler
    securityContext: {}
    
    serviceAccount: kubernetes-dashboard
    serviceAccountName: kubernetes-dashboard
    
    terminationGracePeriodSeconds: 30
    tolerations:
    - effect: NoSchedule
    [...]
    
  • let’s get this token:

      kubectl describe secret kubernetes-dashboard --namespace=kube-system
    
  • and the output:

      Name:         kubernetes-dashboard-certs
      Namespace:    kube-system
      Labels:       k8s-app=kubernetes-dashboard
      Annotations:
      Type:         Opaque
      [...]
      Data
      ====
      token:      <very long string>
      [...]
    
  • Now type the long token in the login page (selecting Token) and you can login to your dashboard:

2