First time at Zeet?

3 Jan
2024
-
4
min read

Troubleshooting the "Kubernetes Dashboard Not Working" Issue

If you're having issues with the Kubernetes dashboard not working or kubernetes-dashboard not found, we thoroughly researched the issue so you can bookmark it for reference. Let's dive into potential causes and solutions.

Sarfaraz Rydhan

Business Development
How To
Content
heading2
heading3
heading4
heading5
heading6
heading7

Share this article

The Kubernetes dashboard not working and "Kubernetes Dashboard not found" errors are so common that we researched the top 20 issues, as well as documented solutions you might try. And if you'd prefer to not deal with this at all, check out issue 21 to learn how Zeet might help you help you with Kubernetes issues like this.

1. Issue: Incorrect RBAC Configuration

Reason: RBAC stands for Role-Based Access Control. Kubernetes utilizes this feature to control who can access the Kubernetes API and what permissions they have. If this is configured incorrectly, the dashboard may not function as expected.

Solution:

Create a <span class="inline-code">ClusterRoleBinding</span>:

kubectl create clusterrolebinding kubernetes-dashboard --clusterrole=cluster-admin --serviceaccount=kube-system:kubernetes-dashboard

Reference: Kubernetes RBAC Docs

2. Issue: Network Policies Blocking Access

Reason: Network Policies in Kubernetes enable you to specify how groups of pods are allowed to communicate with each other and other network endpoints. If these are configured improperly, they may be blocking access to your dashboard.

Solution:

You can exclude the dashboard’s network policy to allow all traffic or correct a misconfigured network policy:

kind: NetworkPolicyapiVersion: networking.k8s.io/v1metadata:  name: allow-allspec:  podSelector: {}  ingress:  - {}

Reference: Kubernetes Network Policies Docs

3. Issue: Dashboard isn't Running

Reason: The Kubernetes dashboard isn't actually running.

Solution:

Check if the dashboard is running:

kubectl get pods --namespace=kube-system | grep dashboard

If it isn't running, you'll need to start it. Here's an example command for starting the Kubernetes dashboard:

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-rc6/aio/deploy/recommended.yaml

You can then access the dashboard at:

http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/

Reference: Kubernetes Dashboard GitHub

4. Issue: Service Account Token Not Working

Reason: The Kubernetes dashboard requires a service account token to log in. If you're having problems, it's possible that this token isn't functioning correctly.

Solution:

This token can be created using the following command:

kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep admin-user | awk '{print $1}')

Reference: Kubernetes Service Accounts Docs

5. Issue: Heapster Is Unavailable

Reason: The dashboard uses Heapster for the auto-discovery feature and for populating the data for some of its views. If Heapster is unavailable, the dashboard may be affected.

Solution:

Ensure that Heapster is running:

kubectl get pods --namespace=kube-system | grep heapster

If it's not, you can deploy it using its spec file:

kubectl apply -f heapster.yaml

Reference: Heapster GitHub

6. Issue: Kubernetes Dashboard Access Denied or Unauthorized Error

Reason: If an "Access Denied!" or "Unauthorized" error message is displayed when accessing the Kubernetes Dashboard, it implies that the current user lacks access to the namespace involved. This can be caused by Service Account misconfigurations.

Solution:

Create a new Service Account, Cluster Role Binding, and retrieve token in terminal:

kubectl create serviceaccount dashboard-admin -n kubernetes-dashboardkubectl create clusterrolebinding dashboard-admin-sa -n kubernetes-dashboard --clusterrole=cluster-admin --serviceaccount=kubernetes-dashboard:dashboard-adminkubectl describe secret -n kubernetes-dashboard $(kubectl -n kubernetes-dashboard get secret | grep dashboard-admin | awk '{print $1}')

Reference: https://github.com/kubernetes/dashboard/issues/2722

7. Issue: Failed to load Kubernetes Dashboard

Reason: Sometimes, Kubernetes Dashboard might totally fail to load. This can be propagated by incorrect settings in Ingress controller, blocking the necessary websockets which the dashboard requires.

Solution:

You need to enable websocket support in your ingress controller. An example for nginx ingress controller:

nginx.ingress.kubernetes.io/enable-websockets: "true"

Reference: https://github.com/kubernetes/ingress-nginx/issues/2980

8. Issue: Kubernetes Dashboard shows "Service Unavailable" error

Reason: Misconfigurations or network policies can lead to a "Service Unavailable" error.

Solution:

Check and ensure that the Kubernetes dashboard pods are running in the correct namespace. You can do this with:

kubectl get pods --namespace=kubernetes-dashboard

If they are not running, you might need to check the logs for the specific dashboard pod with:

kubectl logs  --namespace=kubernetes-dashboard

Reference: https://github.com/kubernetes/dashboard/issues/3838

9. Issue: URL redirection breaks Kubernetes Dashboard

Reason: Incorrect URL or path rewriting by an Ingress controller can break the Dashboard UI.

Solution:

Make sure the rewrite rule for the Ingress allows access to the dashboard. Beware of undesired path rewriting. Here's an example for the rewrite rule:

nginx.ingress.kubernetes.io/rewrite-target: /

Reference: https://github.com/kubernetes/ingress-nginx/issues/3146

10. Issue: Unauthorized 401 error after upgrading Kubernetes Dashboard

Reason: Sometimes, after upgrading Kubernetes Dashboard, users receive 401 Unauthorized errors when trying to access metrics data even after logging in correctly.

Solution:

You should create or assign the correct roles to the dashboard's service account to access metrics. Here's an example for the role creation:

apiVersion: rbac.authorization.k8s.io/v1kind: ClusterRolemetadata:  name: kubernetes-dashboardrules:- apiGroups:  - metrics.k8s.io  resources:  - pods  - nodesverbs:  - get  - list  - watch

Reference: https://github.com/kubernetes/dashboard/issues/5532

11. Issue: Incorrect Dashboard Installation

Reason: If your Kubernetes Dashboard isn't working, the first probable cause might be incorrect installation. This could be as a result of missing command parameters, misconfigurations, or incorrect cluster context.

Solution:
Ensure to follow the correct steps for deploying the dashboard which includes creating a service account, assigning the right roles, and deploying the dashboard correctly.

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta8/aio/deploy/recommended.yaml
kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep admin-user | awk '{print $1}')

12. Issue: Insufficient Permissions

Reason: Insufficient permissions for the user meant to access the dashboard would prevent the Kubernetes dashboard from displaying as it should.

Solution:

You can create a ServiceAccount and bind it with cluster-admin role for complete access. (Note: Adjust according to real permission needs)

kubectl create serviceaccount dashboard-admin-sakubectl create clusterrolebinding dashboard-admin-sa --clusterrole=cluster-admin --serviceaccount=default:dashboard-admin-sa

13. Issue: Network Policy Issues

Reason: If there are network policies in place that disallow connections, the Kubernetes dashboard might not work as expected.

Solution:

Adjust network policies to allow connections to the Dashboard service.

14. Issue: Connectivity Issues

Reason: Another cause to look out for could be connectivity issues involving the Kube API server.

Solution:

To troubleshoot connectivity issues, try directly accessing the API server. Commands like <span class="inline-code">kubectl cluster-info</span> and <span class="inline-code">kubectl get nodes</span> can be useful to debug connectivity problems.

kubectl cluster-info
kubectl get nodes

Reference: https://kubernetes.io/docs/tasks/debug/debug-cluster/troubleshoot-kubectl/

15. Issue: Kubeadm Bootstrap Issues

Reason: When using kubeadm to bootstrap your cluster, discrepancies can arise that disrupt the functioning of the dashboard.

Solution:

You can rectify these issues by examining the process and ensuring kubeadm bootstrap is done correctly and resolved any issues that may arise.

Reference: https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/troubleshooting-kubeadm/

16. Issue: Incorrect Role Bindings or Service Account

Reason: Mismatched role bindings or service account can lead to issues with the Kubernetes dashboard.

Solution:

Create a service account for the dashboard and bind it to the appropriate role. For example:

kubectl create serviceaccount kubernetes-dashboard -n kube-systemkubectl create clusterrolebinding kubernetes-dashboard --clusterrole=cluster-admin --serviceaccount=kube-system:kubernetes-dashboard

Reference: https://stackoverflow.com/questions/44110876/kubernetes-dashboard-is-showing-403-after-installing

17. Issue: Wrong or expired token

Reason: Using an expired or wrong token may lead to some issues when trying to access the dashboard.

Solution:

Generate a new token and use it to log in to the dashboard. For example:

kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep kubernetes-dashboard | awk '{print $1}')

Reference: https://community.kodekloud.com/t/kubernetes-dashboard-can-not-login/5071

18. Issue: Using incorrect port

Reason: The Kubernetes dashboard might not work if the incorrect port is used to access it.

Solution:

Ensure you use the correct port for the Kubernetes dashboard. First, get the port using:

kubectl -n kubernetes-dashboard get service kubernetes-dashboard

Then, use the obtained port number to access the dashboard.

Reference: https://stackoverflow.com/questions/53479924/kubernetes-dashboard-shows-503-service-unavailable

19. Issue: Firewall restrictions

Reason: Firewall settings might block you from accessing the Kubernetes dashboard.

Solution:

You might need to adjust your firewall to allow you to access the Kubernetes dashboard. This varies depending on your environment.

Reference: https://stackoverflow.com/questions/37286939/is-accessing-the-kubernetes-web-ui-dashboard-possible-if-api-server-is-set-up-to

20. Issue: Network Configuration Issues

Reason: Networking issues might hinder your access to the Kubernetes dashboard. This includes incorrect DNS settings or routing configurations.

Solution:

Ensure that your DNS settings are accurate and that your network is configured properly.

For example, you can check the DNS of a particular pod using:

kubectl exec -ti  -- nslookup kubernetes.default 

This should return the ClusterIP of the kubernetes service. If it fails, that means there might be an issue with your network setup.

Reference: https://stackoverflow.com/questions/43212267/unable-to-access-kubernetes-dashboard-from-outside-gce

21. Issue: Managing Your Growing Kubernetes Footprint Is Bogging Your Team Down and You Want to Use Tools to Help

Reason: It's hard to be an expert and stay up to date on all things Kubernetes, as well as the cloud provider's tools and services. And sometimes your time is better used on other areas than fixing errors like the Kubernetes dashboard not working.

Solution:

Use Zeet for simplifying Kubernetes and cloud operations.

Zeet is a Deployment and CI/CD platform for Kubernetes that includes a Dashboard for developers and SRE. If you want to learn more, view Zeet's Product Overview or Kubernetes Solution to see how we might help reduce the complex parts away from your Kubernetes operations.

Subscribe to Changelog newsletter

Jack from the Zeet team shares DevOps & SRE learnings, top articles, and new Zeet features in a twice-a-month newsletter.

Thank you!

Your submission has been processed
Oops! Something went wrong while submitting the form.