How kubernetes/dashboard works
Based on our analysis of the project’s file tree and README, this is the Kubernetes Dashboard – a multi-container, web‐based UI that manages and monitors Kubernetes clusters. The project is split into multiple Go modules (API, Auth, Metrics Scraper, and Web) along with shared libraries and common tooling. It is deployed using a Helm chart and uses a Kong gateway as a reverse proxy to stitch the various containers together.
Main components
• Frontend (Web UI) Module: This is contained in modules/web. It provides the rich user interface (built with Angular, TypeScript, SCSS, etc.) and interacts with the API backend to display data and provide an interactive experience.
• Backend API Module: Located in modules/api, this service aggregates data from the Kubernetes cluster, handles API requests, and implements business logic using many dedicated resource packages.
• Auth Module: Found in modules/auth, this module manages authentication (login, session management, token validation) and user access control.
• Metrics Scraper Module: In modules/metrics-scraper, this component is responsible for gathering metrics from various cluster components.
• Shared/Utility Libraries: The common modules (modules/common) provide essential functionality such as certificate management, API clients, error handling, and middleware (like CSRF protection). These are used by the API, Auth, and even the Web modules.
• Gateway (Kong): According to the README and related configuration/hack files, a single-container, DBless Kong gateway is used as the API proxy. This container routes external requests to the appropriate backend container.
• Helm Chart and Kubernetes Deployment: The charts directory (charts/kubernetes-dashboard) contains the Helm chart to define the Kubernetes resources (deployments, services, ingress, RBAC, etc.) and customize installation settings.
Relationships and Data Flow
• End users interact with the Web UI via a browser.
• Requests hit the Kong gateway, which forwards traffic to the appropriate backend container based on API endpoints.
• The Web UI communicates with the API to retrieve or update data.
• The Auth module handles login and user sessions, interfacing with both the API and the Web UI.
• The Metrics Scraper independently queries cluster resources, and its output flows into the API for display.
• Internal shared libraries facilitate cross-module concerns (error handling, client caching, and resource management).
• The Helm chart acts as the deployment orchestrator, ensuring all services are deployed and interconnected properly within a Kubernetes cluster.
Architectural Patterns and Design Principles
• Modular Architecture/Microservices: Each core function (API, Auth, Metrics, and UI) is isolated in its own module allowing independent development and versioning.
• API Gateway Pattern: The Kong gateway provides a single entry point for traffic and abstracts complexities from internal service communication.
• Containerization and Declarative Deployment: Dockerfiles and Helm charts encapsulate deployment, scaling, and environment configuration.
• Reuse via Shared Libraries: Common functionality is abstracted into modules (e.g., common client, certificates, CSRF middleware), ensuring consistency across services.
• Separation of Concerns: Frontend (Angular-based UI) is clearly decoupled from backend services (written in Go), each handling its domain responsibilities.