# Access the Kubernetes Dashboard

## Deploy and Access the Kubernetes Dashboard

Dashboard is a web-based Kubernetes user interface. Provides information on the state of Kubernetes resources in your cluster and on any errors that may have occurred.

<figure><img src="/files/0Zad6qKAwEFyAHShGe5v" alt=""><figcaption></figcaption></figure>

### Deploying the Dashboard UI <a href="#deploying-the-dashboard-ui" id="deploying-the-dashboard-ui"></a>

The Dashboard UI is not deployed by default. To deploy it, run the following command:

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

After completing the installation, your pod must be running successfully.\\

<figure><img src="/files/gH9mhquZ2QtsvsWP0pd3" alt=""><figcaption></figcaption></figure>

Now, to be able to expose the dashboard for external access, we need to change the service's ClusterIP type to NodePort.

<figure><img src="/files/oCkjtNKLiWkYIdkCBVdQ" alt=""><figcaption></figcaption></figure>

We can make this change simply by editing the service.

```
sudo kubectl edit service kubernetes
```

<figure><img src="/files/SkBMyGnQ3qfWTVzkeNsl" alt=""><figcaption></figcaption></figure>

After making the change to `NodePort`, save and close the file.

When performing a new query, notice that the type has changed and now a new port has been added.

<figure><img src="/files/zDKByEkeuRQenctII3KV" alt=""><figcaption></figcaption></figure>

Once this is done, you should have access to the dashboard through the public IP of your instance plus the port that was released.

<figure><img src="/files/WVEMW3F9tijJU5UcG8g3" alt=""><figcaption></figcaption></figure>

As we send an http request and expect https then we receive an alert. We can simply move forward by adding https\://\
\\

<figure><img src="/files/Gm7lsSnVsxQUQb3Y91IW" alt=""><figcaption></figcaption></figure>

### Accessing the Dashboard UI <a href="#accessing-the-dashboard-ui" id="accessing-the-dashboard-ui"></a>

Creating sample user:\
Grant this user admin permissions and login to Dashboard using a bearer token tied to this user.

### Creating a Service Account

```yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: admin-user
  namespace: kubernetes-dashboard
```

### Creating a ClusterRoleBinding

We can use it and create only a `ClusterRoleBinding` for our `ServiceAccount`

```yaml
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
```

### Getting a Bearer Token for ServiceAccount

Execute the following command:

```
sudo kubectl -n kubernetes-dashboard create token admin-user
```

### Accessing Dashboard

<figure><img src="/files/m67zKh6hETUnDLnkvaax" alt=""><figcaption></figcaption></figure>

Now we can navigate the dashboard and monitor all clusters.

<figure><img src="/files/2TRgWdSWhAIEZcFJ8YuY" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.stakepool.dev.br/polygon/kubernetes/access-the-kubernetes-dashboard.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
