The Kubernetes Dashboard is an Add-on present in all major K8s platforms (not specific of any of them).
In this walk-though I will start reviewing the access the Web-UI Dashboard for MicroK8s, Minikube, and K3s. Then, I will off-line follow the steps of the Kubenetes Demo post [Link] for components to demonstrate when navigating the Dashboard.
ACCESSING THE DASHBOARD
MicroK8s – Explained in details at [Link].
sudo microk8s enable dashboard sudo microk8s kubectl create token default sudo microk8s kubectl port-forward -n kube-system service/kubernetes-dashboard 8001:443
Minikube – Explained in details at [Link].
minikube addons enable dashboard minikube kubectl -n kube-system describe secret $(minikube kubectl -n kube-system get secret | awk '/^deployment-controller-token-/{print $1}') | awk '$1=="token:"{print $2}' minikube kubectl proxy –address=’0.0.0.0′ –disable-filter=true
K3s – Explained in details at [Link].
k3s kubectl -n kubernetes-dashboard create token admin-user k3s kubectl proxy
- IN ALL CASES
- Navigate to http://127.0.0.1:8001 (if it fails, try HTTPS) and paste generated token.
DASHBOARD WALK-THROUGH
For the sake of the walk-through, I previously deployed demo resources from the post Kubernetes Demo [Link], which are also available in this public repository [Link].
Switch to the created Namespace.
In Deployments, first scale up the desired capacity to 5. Then, edit the deployment configuration.
Note that the manifest was updated in the cluster (not the source deployment.yaml
).
On Pods, there are now 5 pods running. The initial single replica on the bottom plus the new scaled up 4 replicas.
Check out Logs and Exec.
The so called Logs are out the outputs that the container though on the console.
The Exec is actually getting a shell into the container with full permissions.
Both, Logs and Exec are great features for development or troubleshooting.
On Replica Sets, additional information similar features are present like Logs and Scale but it also offer additional pieces of information.
In the Service section, navigate to Ingresses. They can also be edited manually (YAML/JSON).
Same on Ingress Classes and Services.
Down to the section Config and Storage, on Secrets. Edit the secret.
The secret will be encoded in Base64 at the very end of the resource configuration but for some reason it is also in plain text format in the “annotations” parameter. I highly recommend to create secrets that are in some way encrypted or encoded and the application manages to extract on runtime.
Jumping to the Cluster section, on Events, there is a log of each action applied to the resources.
And on Namespaces, they can be modified to better suit each project resources and maintaining isolation.
Finally, on Nodes, system metrics of the nodes of the cluster can be visualised.
REFLECTIONS
The Kubernetes shall never be directly exposed to the internet, nor be continuously running. It is an extremely handy tool for a more graphical visualisation of the deployed resources and simple manual tweaks to their configurations.
The proper way of managing Kubernetes resources is by leveraging tools for source-control like Git combined to a pipeline for automatic deployment of the changes.
If there is a need for using the dashboard in Production, use SSH to create a tunnel to access the exposed port in the remote server’s localhost address. See example:
ssh -L 8001:localhost:8001 k8s-server.com
SEE ALSO
Minikube on Ubuntu 22.04 [Link].
MicroK8s on Ubuntu 22.04 [Link].
K3s on Ubuntu 22.04 [Link].
Kubernetes Persistent Volumes [Link].
Kubernetes Cheat Sheet [Link].