Accessing KubeRaya Cluster Using the Kubernetes Dashboard
KubeRaya, CloudRaya’s Kubernetes as a Service, excels at making the initial setup of your Kubernetes cluster much simpler, reducing the complexities and potential challenges often associated with the installation process.
However, it’s important to keep in mind that, despite KubeRaya’s benefit, there are still some tasks in Kubernetes that may be a bit tricky when done through the command-line interface (CLI).
To further enhance the ease of cluster management, Kubernetes Dashboard, a web-based interface, comes into play. This user-friendly dashboard provides a visual representation of your Kubernetes environment, making ongoing management tasks more accessible.
Beforehand, make sure you have installed kubectl on the workstation where you access your Kubernetes cluster.
kubectl , Kubernetes’ command-line tool, serves various purposes, such as managing clusters and interacting with your cluster resources.
If you haven’t installed it, please visit this Kubernetes documentation page for installation instructions.
Accessing the Kubernetes Cluster
Access your Kubernetes Cluster with the Config File provided in the Cluster’s detail page.
Rename the kubeconfig file you downloaded earlier to
config and move it to its default location, which is
~/.kube unless you want to specify a custom kubeconfig file location via command-line or environment variable.
For Windows users, the default location is typically
Install Kubernetes Dashboard
kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml
The output will confirm that the dashboard has been deployed in the
To access the dashboard, use the following command to create a secure link between your computer and the Kubernetes Dashboard. This link allows you to access the dashboard in your web browser.
kubectl -n kubernetes-dashboard port-forward svc/kubernetes-dashboard 8443:443
You might encounter a “Connection is not private” warning because the Kubernetes Dashboard uses a self-signed SSL certificate, which can’t be automatically verified by your browser.
Click on “Accept the Risk and Continue“.
As you can see, we need to input our cluster’s credentials to log into the dashboard.
So, now, let’s proceed to generate the necessary token.
Generate a Bearer Token
Create a new configuration file in
.yaml format, name it something like
Then, input the following configuration to create a service account and assign the necessary permissions to that service account. You can customize the Service Account’s name, in this case, we’ll create it with the name ‘admin-user.’
apiVersion: v1 kind: ServiceAccount metadata: name: admin-user namespace: kubernetes-dashboard --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: admin-user roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: cluster-admin subjects: - kind: ServiceAccount name: admin-user namespace: kubernetes-dashboard
Once done, save the file. Then, execute it using the following command (make sure you are in the same folder as the yaml file.)
kubectl create -f kubernetes-dashboard-acc.yaml
Now, generate the token for ‘admin-user‘, run:
kubectl -n kubernetes-dashboard create token admin-user
Afterward, the token for ‘admin-user’ will be displayed. Copy this token and return to the browser, paste it into the “Enter Token” field as shown below.
If so, click on “Sign in.”
Accessing & Exploring the Kubernetes Dashboard
After clicking on ‘Sign in’ as indicated above, the dashboard displayed is as follows:
Now, all the activities you usually perform via the CLI can be managed and monitored more conveniently through the GUI.
KubeRaya and the Kubernetes Dashboard provide a seamless way to manage your clusters and resources. With these tools, you can enjoy a more user-friendly approach to Kubernetes management.
For more insightful tutorials about cloud-related topics, be sure to explore our Knowledge Base on this page.