Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 544  / 1 Year ago, sat, april 29, 2023, 4:10:00

I'm trying to get the token for the kubernetes dashboard. It seems none was generated. How do I force it to generate one? Here is what I did:


I've installed Ubuntu 20.04 on a hyperV VM on my local laptop. I used the ubuntu installer to install the microk8s snap.
I then installed dashboard among other things with this command:


microk8s enable dns dashboard storage

With a separate terminal I started a proxy:


microk8s kubectl port-forward -n kube-system service/kubernetes-dashboard 10443:443 --address 0.0.0.0 

which of course asks for a token.
When trying to export the token with:


token=$(microk8s kubectl -n kube-system get secret | grep default-token | cut -d " " -f1)
microk8s kubectl -n kube-system describe secret $token

the resulting output shows no token:


Name:         kubernetes-dashboard-certs
Namespace: kube-system
Labels: k8s-app=kubernetes-dashboard
Annotations: <none>

Type: Opaque

Data
====


Name: kubernetes-dashboard-csrf
Namespace: kube-system
Labels: k8s-app=kubernetes-dashboard
Annotations: <none>

Type: Opaque

Data
====
csrf: 256 bytes


Name: kubernetes-dashboard-key-holder
Namespace: kube-system
Labels: <none>
Annotations: <none>

Type: Opaque

Data
====
priv: 1675 bytes
pub: 459 bytes

More From » kubernetes

 Answers
1

You're probably already on version 1.24 or higher. So the command is much simpler:


microk8s kubectl create token default


will throw a token to stdout which you can use for the dashboard.


[#401] Sunday, April 30, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ousear

Total Points: 395
Total Questions: 114
Total Answers: 89

Location: Jordan
Member since Thu, Aug 5, 2021
3 Years ago
ousear questions
Tue, Sep 27, 22, 03:29, 2 Years ago
Thu, Nov 25, 21, 00:51, 2 Years ago
Tue, Feb 22, 22, 17:47, 2 Years ago
Wed, Jul 6, 22, 14:55, 2 Years ago
;