How to fix Kubernetes Dashboard Forbidden 403 error
It can be frustrating when you get a “403 Forbidden” error when trying to access the Kubernetes Dashboard. This issue usually indicates you do not have the right sort of liberties to access the dashboard using your user account. Here’s an easy instructions for fixing the issue at hand:
- Check User Permissions: Check that you have sufficient rights to access the dashboard using the user or service account you are using. By going at the associated duties and role bindings, you may verify this.
- Create a Service Account: Create a dedicated service account and give the necessary permissions.
kubectl create serviceaccount dashboard-admin -n kube-system
- Bind the Service Account to a ClusterRole: The administrator of the newly developed service account full privileges, bind it to the cluster-admin ClusterRole.
kubectl create clusterrolebinding dashboard-admin-binding \
--clusterrole=cluster-admin \
--serviceaccount=kube-system:dashboard-admin
- Retrieve the Bearer Token: Obtain the token to the newly established service account. By the assistance of this token, your access to the dashboard has been verified.
- Obtain a copy of the output’s token.
kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep dashboard-admin | awk '{print $1}')
- Access the Dashboard: The Kubernetes Dashboard URL typically looks like https://<master-ip>:<port>/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/. Open your web browser and visit here.
- Select the token option and paste the copied token when asked for for authentication.
- Secure Your Setup: While finish permissions have been provided by the cluster-admin role, this configuration might not be the most secure option for production environments. Think considering attaching a custom role to the service account with only the privileges required for your use case.
Kubernetes – Dashboard Setup
Kubernetes – Dashboard Setup is a web-based user interface that offers a summary of your Kubernetes cluster. You may manage your resources using a graphical interface and view information about your pods, deployments, services, and more with the dashboard. How do you maintain track of all the containers you deploy using Kubernetes when there are hundreds of them? That won’t work with a command-line interface. Everything must be represented visually. Welcome to the Kubernetes dashboard. The official web-based UI for Kubernetes, known as Kubernetes Dashboard, consists of a collection of services that make cluster management easier. You will discover how to set up the Kubernetes Dashboard on an Ubuntu computer step-by-step in this guide.