LAB 13.3 trouble finding token
I followed lab steps and the dashboard page is loading.
Just to mention that other than changing port type to NodePort, I also had to edit values.yaml to enable insecure login
extraArgs: - --enable-insecure-login
or otherwise I was only getting an error page about requesting HTTP website over HTTPS
So, now I am at step 6 but I don't have dashboard-kubernetes-dashboard-token- object.
kubectl get serviceaccounts
NAME SECRETS AGE dashboard-kubernetes-dashboard 0 19m default 1 5d1h myingress-ingress-nginx 0 19h
I noticed that in the lab that SECRETS is 1 for dashboard-kubernetes-dashboard and I get 0...
kubectl get secrets
NAME TYPE DATA AGE dashboard-kubernetes-dashboard-certs Opaque 0 14m default-token-56tsp kubernetes.io/service-account-token 3 5d1h kubernetes-dashboard-csrf Opaque 1 14m kubernetes-dashboard-key-holder Opaque 2 14m myingress-ingress-nginx-admission Opaque 3 19h sh.helm.release.v1.dashboard.v1 helm.sh/release.v1 1 14m sh.helm.release.v1.myingress.v1 helm.sh/release.v1 1 19h
What am I missing?
Thanks in advance
Comments
-
UPDATE
Apparently Kubernetes does not automatically create secrets anymore starting from 1.24
I've tried manually creating a secret for service account, and it seemed to have worked, however when I
kubectl get serviceaccount
I still get 0 secrets for dashboard-kubernetes-dashboard although secret is visible when Ikubectl get secrets
I also tried creating a token with
kubectl create token
However, I've ran into another issue which is disabled login even with
- --enable-insecure-login
flag set:Insecure access detected. Sign in will not be available. Access Dashboard securely over HTTPS or using localhost. Read more here
0 -
Hi @k0dard,
I can't remember having to enable insecure login, but I did have to enable the integration with the metrics-server around line 257 of values.yaml (the metrics-server was pre-installed on my cluster, otherwise there was an install option in values.yaml as well).
Now back to the token... or the lack of it. Secrets holding service account tokens are no longer created by default, so it becomes the user's responsibility to create the token secret for the desired service account.
The command is simple, from the official documentation:
kubectl apply -f - <<EOF apiVersion: v1 kind: Secret metadata: name: kubernetes-dashboard-token annotations: kubernetes.io/service-account.name: kubernetes-dashboard type: kubernetes.io/service-account-token EOF
It creates a secret name
kubernetes-dashboard-token
associated with mykubernetes-dashboard
service account (replace the name if your service account has a different name). You can also create the secret definition manifest first, and then run thekubectl apply
command.Once created, you can describe the secret to reveal the value of the token:
kubectl describe secrets kubernetes-dashboard-token
Regards,
-Chris0 -
Using imperative commands:
$ kubectl get serviceaccounts -n kubernetes-dashboard NAME SECRETS AGE default 0 10m kubernetes-dashboard 0 9m44s $ kubectl create clusterrolebinding dashaccess --clusterrole=cluster-admin --serviceaccount=kubernetes-dashboard:kubernetes-dashboard clusterrolebinding.rbac.authorization.k8s.io/dashaccess created $ kubectl get clusterrolebinding dashaccess NAME ROLE AGE dashaccess ClusterRole/cluster-admin 9m30s $ curl ifconfig.io 173.28.225.52 $ kubectl -n kubernetes-dashboard create token kubernetes-dashboard
I didn't need
--enable-insecure-login
but I did need--kubelet-insecure-tls
0 -
Thanks for your help!
When you say enable the integration with the metrics-server, do you mean metricsScraper option (line 252 in my values.yaml). Otherwise, there is metric-server option (line 279) but in the comment it is written
Enable this if you don't already have metrics-server enabled on your cluster and want to use it with dashboard metrics-scraper
which is not the case...
To get back to the issue, after some additional testing I've got the following:
- if I don't set protocolHttp to true (line 139), I always get the same error (Client sent an HTTP request to an HTTPS server.)
- if I set protocolHttp to true I can see the metrics without logging in, token or anything
- if I add - --enable-insecure-login I cannot login anymore with or without token, on the bottom of the screen I get Insecure access message mentioned in my OP and Sign in button stays inactive even if I paste a token.
This seems strange, doesn't it?
@headkaze If you read the update I've posted just under my OP you'll see that I've already tried adding token with
kubectl create token
command, so I don't really see what was the point of your post? You say you needed--kubelete-insecure-tls
, are you referring to the setup of metrics-server?0 -
I make notes when I do a LAB so I'll paste them in here assuming you've already done the
metrics-server
part correctly.$ helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/ "kubernetes-dashboard" has been added to your repositories $ helm pull kubernetes-dashboard/kubernetes-dashboard $ tar -zxvf kubernetes-dashboard-5.7.0.tgz $ cd kubernetes-dashboard $ nano values.yaml
I did have to enable the
metricsScraper
otherwise the dashboard doesn't show any CPU or memory usage etc.... service: type: NodePort # Dashboard service port externalPort: 443 ... metricsScraper: ## Wether to enable dashboard-metrics-scraper enabled: true image: repository: kubernetesui/metrics-scraper tag: v1.0.8 resources: {} ...
$ kubectl create ns kubernetes-dashboard namespace/kubernetes-dashboard created $ helm install kubernetes-dashboard --namespace kubernetes-dashboard .
Then I created the cluster role and token (as posted above)
$ kubectl get serviceaccounts -n kubernetes-dashboard NAME SECRETS AGE default 0 10m kubernetes-dashboard 0 9m44s $ kubectl create clusterrolebinding dashaccess --clusterrole=cluster-admin --serviceaccount=kubernetes-dashboard:kubernetes-dashboard clusterrolebinding.rbac.authorization.k8s.io/dashaccess created $ kubectl get clusterrolebinding dashaccess NAME ROLE AGE dashaccess ClusterRole/cluster-admin 9m30s $ curl ifconfig.io 173.28.225.52 $ kubectl -n kubernetes-dashboard create token kubernetes-dashboard
Finally to get the url:
$ export NODE_PORT=$(kubectl get -n kubernetes-dashboard -o jsonpath="{.spec.ports[0].nodePort}" services kubernetes-dashboard) $ export NODE_IP=$(kubectl get nodes -o jsonpath="{.items[0].status.addresses[0].address}") $ echo https://$NODE_IP:$NODE_PORT/
In my case I place in my browser
https://mycluster-cp1:31370
then it should take you to a login where you paste in your token.0 -
Hi @k0dard,
Yes, I did mean the metricsScraper, which oddly is on a different line in my values.yaml file
As far as https - it is default, just as @headkaze confirmed in his comment. If you have a chance to describe the kubernetes-dashboard service, the ports object defines port number 443 tagged with name=https, which even as a NodePort accepts https traffic.
The protocolHttp behavior makes some sense. When false, it allows the https default protocol, and throws the http request to https server error if the request is http instead of the expected https. When true, it overrides https and accepts http traffic instead.
I have not yet explored the enable-insecure-login so I can't comment on its behavior.
Regards,
-Chris0 -
-
It turns out that my browser, since the SSL certificate is not valid, automatically redirected me to http. If I manually add https:// before my server IP and accept the security risk, the Sign in button becomes active again...
Thanks everyone for your help, I appreciate it!
0
Categories
- All Categories
- 217 LFX Mentorship
- 217 LFX Mentorship: Linux Kernel
- 788 Linux Foundation IT Professional Programs
- 352 Cloud Engineer IT Professional Program
- 177 Advanced Cloud Engineer IT Professional Program
- 82 DevOps Engineer IT Professional Program
- 146 Cloud Native Developer IT Professional Program
- 137 Express Training Courses
- 137 Express Courses - Discussion Forum
- 6.2K Training Courses
- 46 LFC110 Class Forum - Discontinued
- 70 LFC131 Class Forum
- 42 LFD102 Class Forum
- 226 LFD103 Class Forum
- 18 LFD110 Class Forum
- 37 LFD121 Class Forum
- 18 LFD133 Class Forum
- 7 LFD134 Class Forum
- 18 LFD137 Class Forum
- 71 LFD201 Class Forum
- 4 LFD210 Class Forum
- 5 LFD210-CN Class Forum
- 2 LFD213 Class Forum - Discontinued
- 128 LFD232 Class Forum - Discontinued
- 2 LFD233 Class Forum
- 4 LFD237 Class Forum
- 24 LFD254 Class Forum
- 693 LFD259 Class Forum
- 111 LFD272 Class Forum
- 4 LFD272-JP クラス フォーラム
- 12 LFD273 Class Forum
- 145 LFS101 Class Forum
- 1 LFS111 Class Forum
- 3 LFS112 Class Forum
- 2 LFS116 Class Forum
- 4 LFS118 Class Forum
- 5 LFS142 Class Forum
- 5 LFS144 Class Forum
- 4 LFS145 Class Forum
- 2 LFS146 Class Forum
- 3 LFS147 Class Forum
- 1 LFS148 Class Forum
- 15 LFS151 Class Forum
- 2 LFS157 Class Forum
- 25 LFS158 Class Forum
- 7 LFS162 Class Forum
- 2 LFS166 Class Forum
- 4 LFS167 Class Forum
- 3 LFS170 Class Forum
- 2 LFS171 Class Forum
- 3 LFS178 Class Forum
- 3 LFS180 Class Forum
- 2 LFS182 Class Forum
- 5 LFS183 Class Forum
- 31 LFS200 Class Forum
- 737 LFS201 Class Forum - Discontinued
- 3 LFS201-JP クラス フォーラム
- 18 LFS203 Class Forum
- 130 LFS207 Class Forum
- 2 LFS207-DE-Klassenforum
- 1 LFS207-JP クラス フォーラム
- 302 LFS211 Class Forum
- 56 LFS216 Class Forum
- 52 LFS241 Class Forum
- 48 LFS242 Class Forum
- 38 LFS243 Class Forum
- 15 LFS244 Class Forum
- 2 LFS245 Class Forum
- LFS246 Class Forum
- 48 LFS250 Class Forum
- 2 LFS250-JP クラス フォーラム
- 1 LFS251 Class Forum
- 150 LFS253 Class Forum
- 1 LFS254 Class Forum
- 1 LFS255 Class Forum
- 7 LFS256 Class Forum
- 1 LFS257 Class Forum
- 1.2K LFS258 Class Forum
- 10 LFS258-JP クラス フォーラム
- 118 LFS260 Class Forum
- 159 LFS261 Class Forum
- 42 LFS262 Class Forum
- 82 LFS263 Class Forum - Discontinued
- 15 LFS264 Class Forum - Discontinued
- 11 LFS266 Class Forum - Discontinued
- 24 LFS267 Class Forum
- 22 LFS268 Class Forum
- 30 LFS269 Class Forum
- LFS270 Class Forum
- 202 LFS272 Class Forum
- 2 LFS272-JP クラス フォーラム
- 1 LFS274 Class Forum
- 4 LFS281 Class Forum
- 9 LFW111 Class Forum
- 259 LFW211 Class Forum
- 181 LFW212 Class Forum
- 13 SKF100 Class Forum
- 1 SKF200 Class Forum
- 1 SKF201 Class Forum
- 795 Hardware
- 199 Drivers
- 68 I/O Devices
- 37 Monitors
- 102 Multimedia
- 174 Networking
- 91 Printers & Scanners
- 85 Storage
- 758 Linux Distributions
- 82 Debian
- 67 Fedora
- 17 Linux Mint
- 13 Mageia
- 23 openSUSE
- 148 Red Hat Enterprise
- 31 Slackware
- 13 SUSE Enterprise
- 353 Ubuntu
- 468 Linux System Administration
- 39 Cloud Computing
- 71 Command Line/Scripting
- Github systems admin projects
- 93 Linux Security
- 78 Network Management
- 102 System Management
- 47 Web Management
- 63 Mobile Computing
- 18 Android
- 33 Development
- 1.2K New to Linux
- 1K Getting Started with Linux
- 370 Off Topic
- 114 Introductions
- 173 Small Talk
- 22 Study Material
- 805 Programming and Development
- 303 Kernel Development
- 484 Software Development
- 1.8K Software
- 261 Applications
- 183 Command Line
- 3 Compiling/Installing
- 987 Games
- 317 Installation
- 96 All In Program
- 96 All In Forum
Upcoming Training
-
August 20, 2018
Kubernetes Administration (LFS458)
-
August 20, 2018
Linux System Administration (LFS301)
-
August 27, 2018
Open Source Virtualization (LFS462)
-
August 27, 2018
Linux Kernel Debugging and Security (LFD440)