Skip to main content

Introduction

The Kubernetes Dashboard API is a RESTful API that provides programmatic access to Kubernetes cluster resources through a unified interface. The API acts as a proxy between clients and the Kubernetes API server, offering enhanced features like metrics aggregation, resource management, and web terminal access.

Base URL

All API endpoints are prefixed with:
/api/v1

Example

https://dashboard.example.com/api/v1/pod

Architecture

The Dashboard API consists of several key components:
  • API Handler: Core request routing and processing (apihandler.go)
  • Resource Handlers: Kubernetes resource-specific endpoints
  • Integration Manager: Metrics and external service integration
  • Authentication: Bearer token-based authentication
  • WebSocket Support: Real-time terminal and log streaming via SockJS

Server Configuration

The API server can be configured with the following options:
--bind-address
string
default:"0.0.0.0"
The IP address on which to serve HTTPS (set to 0.0.0.0 for all interfaces)
--port
number
default:"8443"
The secure port to listen on for HTTPS
--insecure-bind-address
string
The IP address on which to serve HTTP (disabled by default)
--insecure-port
number
default:"8080"
The port to listen on for HTTP
--metrics-provider
string
default:"sidecar"
Metrics provider for resource metrics (options: sidecar, none)
--sidecar-host
string
The metrics-scraper sidecar host URL

OpenAPI Documentation

When enabled, the API provides OpenAPI/Swagger documentation at:
/apidocs.json
Enable OpenAPI documentation with the --enable-openapi flag.

Common Query Parameters

Many list endpoints support the following query parameters for filtering, sorting, and pagination:
filterBy
string
Comma-delimited string for filtering: propertyName,filterValueExample: filterBy=name,nginx
sortBy
string
Column name to sort byExample: sortBy=creationTimestamp
itemsPerPage
number
default:"10"
Number of items to return per page
page
number
default:"1"
Page number for pagination
metricNames
string
Comma-separated list of metric names to downloadExample: metricNames=cpu/usage,memory/usage
aggregations
string
Aggregation methods for metrics (default: sum)Options: sum, avg, min, max

Response Format

All API responses are in JSON format with the following general structure:

Success Response

{
  "listMeta": {
    "totalItems": 100
  },
  "items": [...],
  "errors": []
}

Error Response

{
  "status": "Failure",
  "message": "Error message",
  "reason": "BadRequest",
  "code": 400
}

Content Types

The API accepts and returns the following content types:
  • Accept: application/json
  • Content-Type: application/json

Rate Limiting

The API implements client-side rate limiting with configurable QPS (queries per second) and burst settings:
  • Default QPS: Follows Kubernetes client-go defaults
  • Configurable via server startup parameters

CSRF Protection

POST requests require CSRF token validation. Obtain a CSRF token using:
GET /api/v1/csrftoken/{action}
token
string
One-time CSRF token for the specified action
Include the token in the X-CSRF-TOKEN header for POST requests.

Metrics Integration

The API supports metrics collection through the metrics-scraper sidecar:
  • CPU usage: cpu/usage
  • Memory usage: memory/usage
  • Custom metrics: Extensible through integrations

Proxy Mode

The API can run in proxy mode for development and testing, bypassing in-cluster authentication.

Next Steps

Authentication

Learn about API authentication mechanisms

Resources

Explore Kubernetes resource endpoints

Handlers

Discover special handlers for terminal and logs

Metrics

Access metrics and monitoring data

Build docs developers (and LLMs) love