Architecture
Web Terminal connects a browser session to a Kubernetes Pod through the platform WebSocket service. The web-cli backend manages cluster clients, creates terminal Pods, and forwards the interactive stream to the browser.
TOC
Interaction DiagramRequest FlowSession and Pod ManagementCached Cluster MetadataObservability BoundaryInteraction Diagram
The following sequence shows how a terminal session is established and how command output returns to the browser.
Request Flow
The request flow is as follows:
- Click Web CLI in the top-right corner of the platform page.
- The platform opens the Web Terminal session page at
/console-webcli, which lists the available clusters and their nodes in its left pane. - Selecting a cluster or a node opens a sub-tab, and the frontend opens the
/auth/v1/pod/shellWebSocket for that target through the platform service. - The platform audit middleware processes the WebSocket request and forwards it to web-cli.
- The terminal handler authenticates the request and resolves the selection to a cluster or node terminal.
- The terminal manager creates or reuses a terminal Pod in the system namespace.
- The handler connects the WebSocket stream to the Pod exec session.
- The manager records activity and periodically reconciles active sessions.
Session and Pod Management
The terminal manager stores active session records locally, synchronizes them through the active-terminals ConfigMap, recovers sessions after a restart, and removes sessions that exceed the idle timeout. It finds terminal Pods with the web-terminal=true label selector and checks the cluster terminal capacity before creating a new cluster terminal Pod. See Terminal Sessions and Terminal Pods for the session lifecycle and Pod semantics.
Cached Cluster Metadata
The client manager caches cluster clients and Registry metadata for one hour. The cache reduces repeated client creation and expires when the lifetime elapses or the related credentials change.
Observability Boundary
The service exposes Prometheus metrics at /terminal/metrics. Authentication, authorization, and audit processing are provided through the platform server and middleware integration.