Overview
Handler endpoints provide specialized functionality beyond standard resource CRUD operations, including interactive terminal access, log streaming, file downloads, and advanced filtering.Terminal Handler
The terminal handler enables interactive shell access to containers via WebSocket (SockJS) connections.Initialize Terminal Session
Initialize a shell session to a containerPath Parameters:
namespace: Pod namespacepod: Pod namecontainer: Container name
shell: Preferred shell (optional:bash,sh,powershell,cmd)
Session ID for binding the WebSocket connection
Example Request
Example Response
WebSocket Connection
After obtaining the session ID, establish a SockJS connection:Terminal Message Protocol
The terminal uses a JSON-based message protocol:Bind Message (Client → Server)
Stdin Message (Client → Server)
Resize Message (Client → Server)
Stdout Message (Server → Client)
Toast Message (Server → Client)
Shell Selection
If no shell is specified or the specified shell is invalid, the system tries shells in this order:bashshpowershellcmd
Session Timeout
WebSocket connections must be established within 10 seconds of receiving the session ID, or the session will be automatically cleaned up.Terminal Features
- Full TTY support: Supports terminal control codes and formatting
- Resize handling: Dynamic terminal resizing
- Multiple shell support: Automatically detects available shells
- Session isolation: Each session is uniquely identified and isolated
Log Handler
Retrieve and download container logs.Get Logs
Get logs from the first container in a Pod
Get logs from a specific containerQuery Parameters:
previous: Get logs from previous container instance (boolean)tailLines: Number of lines to show from the end of logstimestamps: Include timestamps (boolean)sinceTime: Show logs since timestamp (RFC3339)
Array of log lines
Log metadata including pod info and timestamps
Example Request
Example Response
Download Log File
Download logs as a text fileResponse Type:
text/plainGet Log Sources
Get available log sources for a resource (e.g., containers in a deployment)Path Parameters:
namespace: Resource namespaceresourceName: Name of the resourceresourceType: Type of resource (e.g.,deployment,replicaset)
List of available log sources with pod and container information
Download Handler
The download handler provides file download functionality with proper content-type headers.Implementation
The handler automatically sets theContent-Type header to text/plain and streams content to the client:
- Log file downloads
- Configuration exports
- Custom resource exports
Filter Handler
The filter system processes query parameters for resource filtering, sorting, and pagination.Request Logging
All requests are logged with the following information:/api/v1/login, /api/v1/csrftoken/login) have their content hidden unless debug logging is enabled.
Response Logging
CSRF Validation
POST requests are validated for CSRF tokens unless:- CSRF protection is disabled via
--disable-csrf - The request is to a validation endpoint (
/api/v1/appdeployment/validate/*)
Metrics Collection
All requests are automatically tracked with Prometheus metrics:Total API requests broken down by verb, resource, client, content type, and status code
Request latency distribution in microsecondsBuckets: 125ms to 8 seconds (exponential)
Request latency summary with 1-hour sliding window
Client IP Detection
The filter extracts client IPs from proxy headers in this order:X-Original-Forwarded-ForX-Forwarded-ForX-Real-Ip- Direct
RemoteAddr
Integration Handler
Integration endpoints are managed through the Integration Manager for metrics and external services.Metrics Integration Endpoints
See Metrics API for detailed metrics integration endpoints.Health Check
Integrations expose health check endpoints through the integration handler:WebSocket (SockJS) Handler
The SockJS handler is mounted at:Connection Flow
- Client requests terminal session via REST API
- Server returns session ID
- Client establishes SockJS connection to
/api/sockjs/ - Client sends “bind” message with session ID
- Server validates and binds the session
- Bidirectional communication begins
SockJS Configuration
The handler uses default SockJS options:- WebSocket support enabled
- HTTP streaming enabled
- XHR polling as fallback
Error Handling
All handlers use consistent error handling:Success Response
Error Response
Common Error Codes
400- Bad Request (invalid parameters)401- Unauthorized (missing or invalid token)403- Forbidden (insufficient permissions)404- Not Found (resource doesn’t exist)500- Internal Server Error