# Kubernetes Dashboard

The **Kubernetes Dashboard** is a web-based user interface provided by Kubernetes to manage and monitor the resources within your Kubernetes clusters. It offers an overview of all the components of a cluster, helping users keep track of nodes, workloads, configurations, and more.

* **Use Cases**: The Kubernetes Dashboard is ideal for:
  * Cluster administrators managing cluster resources.
  * Developers who need to monitor their deployed applications.
  * Operations teams that oversee cluster health and resource consumption.

### Use case of Kubernetes Dashboard&#x20;

The Kubernetes Dashboard is crucial because it:

* **Monitors Cluster Resources**: It provides an in-depth view of all resources running in the cluster, from workloads and storage to network policies.
* **Improves Efficiency**: By visualizing metrics like CPU and memory usage, admins can detect bottlenecks, optimize performance, and address issues in real time.
* **Simplifies Management**: Allows users to perform CRUD operations on resources, making management tasks more intuitive.

### **Details visible on the Kubernetes Dashboard**

The Kubernetes Dashboard provides a detailed view of the following resources:

* **Nodes**: Displays node status, resource usage, and related metrics.
* **Workloads**:
  * **Overview**: A summary of all workloads running in the cluster.
  * **Pods**: Active instances of your workloads.
  * **Deployments**: Information about replicated application workloads.
  * **Daemon Sets**: Automatically running pods on every node.
  * **Stateful Sets**: Workloads with stable network IDs and persistent storage.
  * **Replica Sets**: A set of pod replicas for ensuring availability.
  * **Replication Controllers**: Ensures a specified number of pod replicas are running.
  * **Jobs**: Manages batch tasks.
  * **Cron Jobs**: Handles time-scheduled tasks.
* **Config**:
  * **Config Maps**: Configuration settings shared across pods.
  * **Secrets**: Sensitive data storage (e.g., passwords).
  * **Pod Disruption Budgets**: Ensures a minimum number of pods remain available.
  * **Resource Quotas**: Limits the resource usage of namespaces.
  * **Limit Ranges**: Sets resource limits for individual pods.
  * **HPAs**: Horizontal Pod Autoscaler.
  * **VPAs**: Vertical Pod Autoscaler.
  * **Priority Classes**: Sets priority levels for workloads.
  * **Leases**: Allows Kubernetes components to manage leader elections.
  * **Mutating & Validating Webhook Configs**: Defines webhook behaviour for validating and mutating admission requests.
* **Storage**:
  * **Persistent Volumes**: Cluster-wide storage resources.
  * **Persistent Volume Claims**: Requests for storage by pods.
  * **Storage Classes**: Defines storage profiles for dynamic provisioning.
* **Network**:
  * **Services**: Allows communication between pods and external services.
  * **Endpoints**: Information about pod endpoints connected to services.
  * **Ingresses**: Manages external access to services.
  * **Ingress Classes**: Organizes ingress behavior.
  * **Network Policies**: Defines access controls between pods.
  * **Port Forwarding**: Manages port forwarding for testing services.
* **Events**: Tracks important events across the cluster.
* **Namespace**: Organizes cluster resources into logical groups.
* **Access Control**:
  * **Cluster Role**: Sets cluster-wide permissions.
  * **Cluster Role Binding**: Binds users/groups to cluster roles.
  * **Role**: Sets permissions at the namespace level.
  * **Role Binding**: Binds users/groups to roles.
  * **Service Account**: Manages identities for running processes in pods.
  * **Pod Security Policies**: Defines policies for how pods run.

### **Set Up the Kubernetes Dashboard and Start Using It**

* **Step 1**: On the Scoutflo platform, navigate to the sidebar and locate **"Dashboard > Kubernetes Dashboard"** under the 'Workspace dropdown'.

<figure><img src="https://4241237958-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtffWbX4svYQUS7SraAdG%2Fuploads%2FBB5ZYWRxrIfT3N9mGda6%2Fimage.png?alt=media&#x26;token=1f287c39-9259-4984-9d1f-50965615b8a8" alt="" width="563"><figcaption></figcaption></figure>

* **Step 2**: Select any of your connected clusters from the dropdown.

<figure><img src="https://4241237958-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtffWbX4svYQUS7SraAdG%2Fuploads%2FSLtBgsxRbCYnRkPyyTsa%2Fimage.png?alt=media&#x26;token=e6cd6253-07dc-4c74-a907-b0666868e276" alt="" width="549"><figcaption></figcaption></figure>

* **Step 3**: Once a cluster is selected, the dashboard will display all the resources and related information for that specific cluster.

<figure><img src="https://4241237958-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtffWbX4svYQUS7SraAdG%2Fuploads%2FCsAlFxIbA0htbRR3YoUi%2Fimage.png?alt=media&#x26;token=20c0a6fd-93bd-4d51-a6a2-d7f8eba25530" alt="" width="563"><figcaption></figcaption></figure>

### **Functionalities of the Dashboard**

* **Resource List**: Clicking on any resource (e.g., Pods, Nodes) will provide a list of items in that category.

<figure><img src="https://4241237958-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtffWbX4svYQUS7SraAdG%2Fuploads%2Fp3Up8CKsol8R4oAMG9GV%2Fimage.png?alt=media&#x26;token=dffe6531-8c3c-4a57-b4bb-5a2b8fcc14fd" alt="" width="563"><figcaption></figcaption></figure>

* **Detailed Resource Data**: Clicking on a specific resource opens a side panel with detailed information, including:
  * **Metrics**: Graphs showing current CPU and Memory usage.
  * **Properties**:
    * Creation Timestamp
    * Name, Namespace, Labels, Annotations
    * Selector, Node Selector
    * Images, Strategy Type, Tolerations, Key, Operator, Value, Effect, Affinities
    * Pod Status and detailed Pod information (Name, Node, Namespace).

<figure><img src="https://4241237958-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtffWbX4svYQUS7SraAdG%2Fuploads%2Fc5m9e6RipPuEcrViyiyW%2Fimage.png?alt=media&#x26;token=8f01348b-86df-463f-82f9-cbe3b06576d8" alt="" width="563"><figcaption></figcaption></figure>

* **Events Section**: Displays all events related to the selected resource.

<figure><img src="https://4241237958-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtffWbX4svYQUS7SraAdG%2Fuploads%2FO8pSd0lhBUNuAUeD7iqY%2Fimage.png?alt=media&#x26;token=fb8394d3-e522-41ef-b082-cb56a79f0e2f" alt="" width="563"><figcaption></figcaption></figure>

* **Manifest File**: A button in the top-right corner of each resource detail page allows access to the resource's manifest file, giving users the ability to view the YAML configuration.

<figure><img src="https://4241237958-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtffWbX4svYQUS7SraAdG%2Fuploads%2FNY7OhkEpuQ2PVR8jTMjj%2Fimage.png?alt=media&#x26;token=579bf1a5-2a88-4340-bb76-6381174082de" alt="" width="563"><figcaption></figcaption></figure>

* You can also **filter** all the resource lists based on '**Namespaces**'. You can see a drop-down for all the namespaces in that cluster in the top right corner. You can select anyone to apply the filter and see the resource list of only that namespace.&#x20;
  * By default "**All Namespaces**" is selected.
  * Once a namespace filter is applied it will be retained across all the resources screen.

<figure><img src="https://4241237958-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtffWbX4svYQUS7SraAdG%2Fuploads%2FDNX1uEeGPN2CD6PgrqhF%2Fimage.png?alt=media&#x26;token=b8247a91-d3ea-41dd-95fb-3f4ff94efc08" alt="" width="278"><figcaption></figcaption></figure>

* You can also use the "**Search"** functionality besides the namespace filter to search for a specific resource by its name.

<figure><img src="https://4241237958-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtffWbX4svYQUS7SraAdG%2Fuploads%2F16Ku4KdaeHiLagBwFR4w%2Fimage.png?alt=media&#x26;token=be6160d9-c7f3-420b-ac5b-384459d88f25" alt="" width="549"><figcaption></figcaption></figure>

***

### Backend working for the Kubernetes Dashboard

1. **Data Fetching and Integration:**
   * The Kubernetes Dashboard on Scoutflo is powered by direct integrations with the Kubernetes API. When users select a cluster from the dashboard, API calls are made to retrieve real-time data on the resources and workloads running in that cluster.
2. **API Interaction:**
   * Scoutflo communicates with the Kubernetes API Server of the selected cluster, using secure authentication mechanisms (e.g., tokens or certificates) to pull data such as metrics, pod statuses, deployments, and more.
3. **Real-Time Monitoring:**
   * Metrics such as CPU and memory usage are gathered from Kubernetes' native resource metrics API and other integrated tools like Prometheus (if configured), providing live monitoring of resource performance.
4. **Resource Information & Events:**
   * When users view a specific resource (e.g., Pods or Deployments), Scoutflo queries the relevant Kubernetes API endpoints to fetch the resource's manifest and event logs, ensuring users can see a detailed breakdown of properties, conditions, and historical events related to that resource.
5. **Security:**
   * All interactions between the Kubernetes Dashboard and clusters are secured using encrypted communication channels, ensuring that sensitive data (like secrets or configs) remains protected while being accessed through the dashboard.
6. **Cluster Selection Logic:**
   * The backend manages multi-cluster setups by dynamically routing API calls based on the selected cluster in the UI. This ensures seamless switching between clusters while maintaining session consistency.
