Services DevOps DevSecOps Cloud Consulting Infrastructure Automation Managed Services AIOps MLOps DataOps Microservices 🔐 Private AINEW Solutions DevOps Transformation CI/CD Automation Platform Engineering Security Automation Zero Trust Security Compliance Automation Cloud Migration Kubernetes Migration Cloud Cost Optimisation AI-Powered Operations Data Platform Modernisation SRE & Observability Legacy Modernisation Managed IT Services 🔐 Private AI DeploymentNEW Products ✨ ZippyOPS AINEW 🛡️ ArmorPlane 🔒 DevSecOpsAsService 🖥️ LabAsService 🤝 Collab 🧪 SandboxAsService 🎬 DemoAsService Bootcamp 🔄 DevOps Bootcamp ☁️ Cloud Engineering 🔒 DevSecOps 🛡️ Cloud Security ⚙️ Infrastructure Automation 📡 SRE & Observability 🤖 AIOps & MLOps 🧠 AI Engineering 🎓 ZOLS — Free Learning Company About Us Projects Careers Get in Touch

Kubernetes Dashboard: How to Deploy and Access It

Kubernetes Dashboard: How to Deploy and Access It

The Kubernetes Dashboard is a web-based UI that simplifies the process of managing and monitoring Kubernetes clusters. Whether you’re a developer or an administrator, the dashboard provides an intuitive way to interact with your cluster and manage resources efficiently.

In this guide, we will cover the steps to deploy the Kubernetes Dashboard, access it, and set up user accounts, including both admin and read-only roles. By the end, you’ll be equipped to manage your Kubernetes resources seamlessly through the dashboard interface.

Kubernetes Dashboard UI displaying cluster management overview

Deploying the Kubernetes Dashboard

Before accessing the Kubernetes Dashboard, you’ll need to deploy it to your cluster. This involves setting up a secure connection and running the necessary commands.

Step 1: Set Up an SSH Tunnel

The Kubernetes Dashboard is accessible only on the localhost, which means you’ll need to create an SSH tunnel to access it from your local machine. Use the following command to create the tunnel:

ssh -L localhost:8001:127.0.0.1:8001 <your-username>@<your-cluster-ip>

This allows your local machine to securely communicate with the cluster.

Step 2: Deploy the Kubernetes Dashboard

Once the SSH tunnel is set up, you can deploy the Kubernetes Dashboard to your cluster. Execute the following command:

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

This will deploy several Kubernetes components, such as the kubernetes-dashboard service and associated configuration files.

If the deployment is successful, you should see output confirming the creation of the necessary components, such as:

namespace/kubernetes-dashboard created
serviceaccount/kubernetes-dashboard created
service/kubernetes-dashboard created

You can verify that the dashboard is running by checking the status of the pods:

kubectl get pods -A

If the pods are running, you’ll see something like this:

kubernetes-dashboard   kubernetes-dashboard-7bbb9b5fc6-gjrn6       1/1    Running   0          107m
kubernetes-dashboard   dashboard-metrics-scraper-74db988864-ld4pw   1/1    Running   0          107m

Creating User Accounts for the Kubernetes Dashboard

Kubernetes supports various methods for managing access control to the dashboard. In this section, we’ll show you how to create both admin and read-only user accounts for accessing the dashboard.

Step 1: Create an Admin User

To grant full access to the Kubernetes Dashboard, start by creating a service account for the admin user. Create a directory for your configuration files:

mkdir ~/dashboard && cd ~/dashboard

Then, create a file named dashboard-admin.yaml and add the following YAML configuration:

apiVersion: v1
kind: ServiceAccount
metadata:
  name: admin-user

Apply the configuration using:

kubectl apply -f dashboard-admin.yaml

Step 2: Generate the Admin Token

Once the admin user is created, generate a token to use for logging into the dashboard:

kubectl -n kubernetes-dashboard create token admin-user

The command will return a long token string, which you will use to authenticate when logging into the dashboard. Keep in mind that this token will change if the dashboard is restarted.

Step 3: Create a Read-Only User

For demonstration or limited access, you may want to create a read-only user. This user will be able to view the cluster but not make any changes. To create the read-only user, create a file called dashboard-read-only.yaml with the following configuration:

apiVersion: v1
kind: ServiceAccount
metadata:
  name: read-only-user

Apply this configuration with:

kubectl apply -f dashboard-read-only.yaml

Then generate a token for the read-only user:

kubectl -n kubernetes-dashboard create token read-only-user

Accessing the Kubernetes Dashboard

After deploying the Kubernetes Dashboard and creating the necessary user accounts, you can access the dashboard securely through a proxy service.

Step 1: Start the Proxy Service

To start the proxy service on your cluster, use the following command:

kubectl proxy

The proxy will run on 127.0.0.1:8001, allowing you to access the dashboard through your browser.

Step 2: Log into the Dashboard

Open a browser and navigate to the following URL:

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

When prompted, select Token authentication and paste the admin or read-only token you generated earlier. Click Sign in to access the Kubernetes Dashboard.

Once logged in, you’ll be able to manage your Kubernetes cluster, deploy new pods, and monitor the overall health of your resources. As an admin, you can also create new configurations or manage services with ease.

Enhance Your Kubernetes Management with ZippyOPS

Managing Kubernetes environments can be complex, especially as your cluster grows. ZippyOPS offers expert consulting, implementation, and managed services to help you optimize and scale your Kubernetes infrastructure. With a focus on DevOps, DevSecOps, DataOps, and more, ZippyOPS can streamline your cloud operations, automate tasks, and ensure your Kubernetes cluster is secure and running smoothly.

Explore their services and discover how ZippyOPS can support your Kubernetes journey. Additionally, their products offer powerful tools for AIOps, MLOps, and microservices management, ensuring your systems operate efficiently at scale.

For tailored support, reach out to ZippyOPS at sales@zippyops.com.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top