Skip to content

Instantly share code, notes, and snippets.

@kaihendry
Last active March 4, 2024 15:53
Show Gist options
  • Save kaihendry/c9e0a08af9aeaea3b459623e0f2a557c to your computer and use it in GitHub Desktop.
Save kaihendry/c9e0a08af9aeaea3b459623e0f2a557c to your computer and use it in GitHub Desktop.
Where is the dashboard or k9s?
❯ ssh 81.187.180.148
Welcome to Ubuntu 22.04.4 LTS (GNU/Linux 6.5.0-21-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/pro
System information as of Mon Mar 4 03:50:57 PM UTC 2024
System load: 0.5185546875 Processes: 174
Usage of /: 39.3% of 11.21GB Users logged in: 1
Memory usage: 7% IPv4 address for enp0s3: 81.187.180.148
Swap usage: 0%
Expanded Security Maintenance for Applications is not enabled.
2 updates can be applied immediately.
To see these additional updates run: apt list --upgradable
Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status
Last login: Mon Mar 4 15:48:15 2024 from 81.187.180.175
hendry@hatch:~$ sudo microk8s status --wait-ready
[sudo] password for hendry:
microk8s is running
high-availability: no
datastore master nodes: 127.0.0.1:19001
datastore standby nodes: none
addons:
enabled:
dns # (core) CoreDNS
ha-cluster # (core) Configure high availability on the current node
helm # (core) Helm - the package manager for Kubernetes
helm3 # (core) Helm 3 - the package manager for Kubernetes
disabled:
cert-manager # (core) Cloud native certificate management
cis-hardening # (core) Apply CIS K8s hardening
community # (core) The community addons repository
dashboard # (core) The Kubernetes dashboard
gpu # (core) Automatic enablement of Nvidia CUDA
host-access # (core) Allow Pods connecting to Host services smoothly
hostpath-storage # (core) Storage class; allocates storage from host directory
ingress # (core) Ingress controller for external access
kube-ovn # (core) An advanced network fabric for Kubernetes
mayastor # (core) OpenEBS MayaStor
metallb # (core) Loadbalancer for your Kubernetes cluster
metrics-server # (core) K8s Metrics Server for API access to service metrics
minio # (core) MinIO object storage
observability # (core) A lightweight observability stack for logs, traces and metrics
prometheus # (core) Prometheus operator for monitoring and logging
rbac # (core) Role-Based Access Control for authorisation
registry # (core) Private image registry exposed on localhost:32000
rook-ceph # (core) Distributed Ceph storage using Rook
storage # (core) Alias to hostpath-storage add-on, deprecated
hendry@hatch:~$ microk8s enable dashboard
Infer repository core for addon dashboard
Enabling Kubernetes Dashboard
Infer repository core for addon metrics-server
Enabling Metrics-Server
serviceaccount/metrics-server created
clusterrole.rbac.authorization.k8s.io/system:aggregated-metrics-reader created
clusterrole.rbac.authorization.k8s.io/system:metrics-server created
rolebinding.rbac.authorization.k8s.io/metrics-server-auth-reader created
clusterrolebinding.rbac.authorization.k8s.io/metrics-server:system:auth-delegator created
clusterrolebinding.rbac.authorization.k8s.io/system:metrics-server created
service/metrics-server created
deployment.apps/metrics-server created
apiservice.apiregistration.k8s.io/v1beta1.metrics.k8s.io created
clusterrolebinding.rbac.authorization.k8s.io/microk8s-admin created
Metrics-Server is enabled
Applying manifest
serviceaccount/kubernetes-dashboard created
service/kubernetes-dashboard created
secret/kubernetes-dashboard-certs created
secret/kubernetes-dashboard-csrf created
secret/kubernetes-dashboard-key-holder created
configmap/kubernetes-dashboard-settings created
role.rbac.authorization.k8s.io/kubernetes-dashboard created
clusterrole.rbac.authorization.k8s.io/kubernetes-dashboard created
rolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created
clusterrolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created
deployment.apps/kubernetes-dashboard created
service/dashboard-metrics-scraper created
deployment.apps/dashboard-metrics-scraper created
secret/microk8s-dashboard-token created
If RBAC is not enabled access the dashboard using the token retrieved with:
microk8s kubectl describe secret -n kube-system microk8s-dashboard-token
Use this token in the https login UI of the kubernetes-dashboard service.
In an RBAC enabled setup (microk8s enable RBAC) you need to create a user with restricted
permissions as shown in:
https://github.com/kubernetes/dashboard/blob/master/docs/user/access-control/creating-sample-user.md
hendry@hatch:~$ microk8s kubectl describe secret -n kube-system microk8s-dashboard-token
Name: microk8s-dashboard-token
Namespace: kube-system
Labels: <none>
Annotations: kubernetes.io/service-account.name: default
kubernetes.io/service-account.uid: a88a321f-969e-4136-8d8e-78f9afef5217
Type: kubernetes.io/service-account-token
Data
====
ca.crt: 1123 bytes
namespace: 11 bytes
token: eyJhbGciOiJSUzI1NiIsImtpZCI6ImpBelRna1prUWpKYkZaSUxhUVZQQUVQeFJraG5tbi12d1JvM2V2ajVGemMifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJtaWNyb2s4cy1kYXNoYm9hcmQtdG9rZW4iLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoiZGVmYXVsdCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6ImE4OGEzMjFmLTk2OWUtNDEzNi04ZDhlLTc4ZjlhZmVmNTIxNyIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDprdWJlLXN5c3RlbTpkZWZhdWx0In0.UWsCLDjgTY2pwSvlKBthtX8F_alueXBkMhHSPG_m_frTJIbTMaIMdOSRKVxD7WzkA9t1GZn7t3KC8HG2AF76Ji4w3rzrPUlu8-ywRLwoKDDRLDdR98W4pcOD1FCtUgYhZDgo_LR3cGrkbchBbz6ECly85btX9Ik7ffdx67eVSg8T4drHw2Mkv7D-0QLOtRZt6jp9T9hYFl0mI_HQxh_vnrDEgQ1b_l7NjZdM9P27GAJQBUAS9gicWzpm3J83J6gmpeIQOUKjq1Zhx_6eaviM14h_5F-yUaEcmRxunbsljtltsRlfwlkGTbNv7rUpZx7KupgMgl4D5t_br7RzqY41hA
hendry@hatch:~$ microk8s dashboard-proxy
Checking if Dashboard is running.
Infer repository core for addon dashboard
Waiting for Dashboard to come up.
Trying to get token from microk8s-dashboard-token
Waiting for secret token (attempt 0)
Dashboard will be available at https://127.0.0.1:10443
Use the following token to login:
eyJhbGciOiJSUzI1NiIsImtpZCI6ImpBelRna1prUWpKYkZaSUxhUVZQQUVQeFJraG5tbi12d1JvM2V2ajVGemMifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJtaWNyb2s4cy1kYXNoYm9hcmQtdG9rZW4iLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoiZGVmYXVsdCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6ImE4OGEzMjFmLTk2OWUtNDEzNi04ZDhlLTc4ZjlhZmVmNTIxNyIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDprdWJlLXN5c3RlbTpkZWZhdWx0In0.UWsCLDjgTY2pwSvlKBthtX8F_alueXBkMhHSPG_m_frTJIbTMaIMdOSRKVxD7WzkA9t1GZn7t3KC8HG2AF76Ji4w3rzrPUlu8-ywRLwoKDDRLDdR98W4pcOD1FCtUgYhZDgo_LR3cGrkbchBbz6ECly85btX9Ik7ffdx67eVSg8T4drHw2Mkv7D-0QLOtRZt6jp9T9hYFl0mI_HQxh_vnrDEgQ1b_l7NjZdM9P27GAJQBUAS9gicWzpm3J83J6gmpeIQOUKjq1Zhx_6eaviM14h_5F-yUaEcmRxunbsljtltsRlfwlkGTbNv7rUpZx7KupgMgl4D5t_br7RzqY41hA
error: error upgrading connection: error dialing backend: tls: failed to verify certificate: x509: certificate is valid for 10.0.2.15, not 81.187.180.148
Traceback (most recent call last):
File "/snap/microk8s/6541/scripts/wrappers/dashboard_proxy.py", line 111, in <module>
dashboard_proxy()
File "/snap/microk8s/6541/usr/lib/python3/dist-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/snap/microk8s/6541/usr/lib/python3/dist-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/snap/microk8s/6541/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/snap/microk8s/6541/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/snap/microk8s/6541/scripts/wrappers/dashboard_proxy.py", line 105, in dashboard_proxy
check_output(command)
File "/snap/microk8s/6541/usr/lib/python3.8/subprocess.py", line 415, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/snap/microk8s/6541/usr/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/snap/microk8s/6541/microk8s-kubectl.wrapper', 'port-forward', '-n', 'kube-system', 'service/kubernetes-dashboard', '10443:443', '--address', '0.0.0.0']' returned non-zero exit status 1.
hendry@hatch:~$ sudo apt-get install k9s
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package k9s
hendry@hatch:~$ k9s
Command 'k9s' not found, did you mean:
command 'kas' from deb kas (2.6.3-2)
Try: sudo apt install <deb name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment