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
- 167 LFX Mentorship
- 219 LFX Mentorship: Linux Kernel
- 795 Linux Foundation IT Professional Programs
- 355 Cloud Engineer IT Professional Program
- 179 Advanced Cloud Engineer IT Professional Program
- 82 DevOps Engineer IT Professional Program
- 127 Cloud Native Developer IT Professional Program
- 112 Express Training Courses
- 112 Express Courses - Discussion Forum
- 6.2K Training Courses
- 48 LFC110 Class Forum - Discontinued
- 17 LFC131 Class Forum
- 35 LFD102 Class Forum
- 227 LFD103 Class Forum
- 14 LFD110 Class Forum
- 39 LFD121 Class Forum
- 15 LFD133 Class Forum
- 7 LFD134 Class Forum
- 17 LFD137 Class Forum
- 63 LFD201 Class Forum
- 3 LFD210 Class Forum
- 5 LFD210-CN Class Forum
- 2 LFD213 Class Forum - Discontinued
- 128 LFD232 Class Forum - Discontinued
- 1 LFD233 Class Forum
- 2 LFD237 Class Forum
- 23 LFD254 Class Forum
- 697 LFD259 Class Forum
- 109 LFD272 Class Forum
- 3 LFD272-JP クラス フォーラム
- 10 LFD273 Class Forum
- 153 LFS101 Class Forum
- 1 LFS111 Class Forum
- 1 LFS112 Class Forum
- 1 LFS116 Class Forum
- 1 LFS118 Class Forum
- LFS120 Class Forum
- 7 LFS142 Class Forum
- 7 LFS144 Class Forum
- 3 LFS145 Class Forum
- 1 LFS146 Class Forum
- 3 LFS147 Class Forum
- 1 LFS148 Class Forum
- 15 LFS151 Class Forum
- 1 LFS157 Class Forum
- 33 LFS158 Class Forum
- 8 LFS162 Class Forum
- 1 LFS166 Class Forum
- 1 LFS167 Class Forum
- 3 LFS170 Class Forum
- 2 LFS171 Class Forum
- 1 LFS178 Class Forum
- 1 LFS180 Class Forum
- 1 LFS182 Class Forum
- 1 LFS183 Class Forum
- 29 LFS200 Class Forum
- 736 LFS201 Class Forum - Discontinued
- 2 LFS201-JP クラス フォーラム
- 14 LFS203 Class Forum
- 102 LFS207 Class Forum
- 1 LFS207-DE-Klassenforum
- 1 LFS207-JP クラス フォーラム
- 301 LFS211 Class Forum
- 55 LFS216 Class Forum
- 48 LFS241 Class Forum
- 42 LFS242 Class Forum
- 37 LFS243 Class Forum
- 15 LFS244 Class Forum
- LFS245 Class Forum
- LFS246 Class Forum
- 50 LFS250 Class Forum
- 1 LFS250-JP クラス フォーラム
- LFS251 Class Forum
- 154 LFS253 Class Forum
- LFS254 Class Forum
- LFS255 Class Forum
- 5 LFS256 Class Forum
- 1 LFS257 Class Forum
- 1.3K LFS258 Class Forum
- 10 LFS258-JP クラス フォーラム
- 111 LFS260 Class Forum
- 159 LFS261 Class Forum
- 41 LFS262 Class Forum
- 82 LFS263 Class Forum - Discontinued
- 15 LFS264 Class Forum - Discontinued
- 11 LFS266 Class Forum - Discontinued
- 20 LFS267 Class Forum
- 24 LFS268 Class Forum
- 29 LFS269 Class Forum
- 1 LFS270 Class Forum
- 199 LFS272 Class Forum
- 1 LFS272-JP クラス フォーラム
- LFS274 Class Forum
- 3 LFS281 Class Forum
- 9 LFW111 Class Forum
- 261 LFW211 Class Forum
- 182 LFW212 Class Forum
- 13 SKF100 Class Forum
- 1 SKF200 Class Forum
- 1 SKF201 Class Forum
- 782 Hardware
- 198 Drivers
- 68 I/O Devices
- 37 Monitors
- 96 Multimedia
- 174 Networking
- 91 Printers & Scanners
- 83 Storage
- 743 Linux Distributions
- 80 Debian
- 67 Fedora
- 15 Linux Mint
- 13 Mageia
- 23 openSUSE
- 143 Red Hat Enterprise
- 31 Slackware
- 13 SUSE Enterprise
- 348 Ubuntu
- 461 Linux System Administration
- 39 Cloud Computing
- 70 Command Line/Scripting
- Github systems admin projects
- 90 Linux Security
- 77 Network Management
- 101 System Management
- 46 Web Management
- 64 Mobile Computing
- 17 Android
- 34 Development
- 1.2K New to Linux
- 1K Getting Started with Linux
- 371 Off Topic
- 114 Introductions
- 174 Small Talk
- 19 Study Material
- 507 Programming and Development
- 285 Kernel Development
- 204 Software Development
- 1.8K Software
- 211 Applications
- 180 Command Line
- 3 Compiling/Installing
- 405 Games
- 309 Installation
- 97 All In Program
- 97 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)