Terminal
The terminal is the core feature of Learning UI, providing an interactive shell environment for hands-on learning.
Features
Multiple Terminal Tabs
Users can open multiple terminal tabs, all connected to the same shell container but running independent bash sessions.
Keyboard Shortcuts:
Ctrl+Shift+T: New tabCtrl+Shift+W: Close current tabCtrl+Tab: Next tab- Double-click tab to rename
Code Block Integration
Code blocks in the instructions panel have interactive buttons:
- Copy: Copy code to clipboard
- Run: Execute directly in the active terminal
This allows users to quickly run commands without manual copy-paste.
Resizable Panels
The interface features a draggable divider between the instructions panel and terminal panel. Users can resize according to their preference.
Configuration
Enable/Disable Terminal Tab
You can hide the terminal tab if your scenario uses only the editor or custom services:
terminal: enabled: true # Set to false to hide terminal tabShell Container
The terminal connects to the shell container in the StatefulSet. Configure it in your values:
shell: image: repository: debian tag: bookworm pullPolicy: IfNotPresent
command: ["sleep"] args: ["infinity"]
resources: requests: memory: "256Mi" cpu: "100m" limits: memory: "512Mi" cpu: "500m"How It Works
- The UI pod runs a Go server that handles WebSocket connections
- When a terminal tab is opened, a WebSocket connection is established to
/ws/terminal - The server uses
kubectl execto spawn a bash session in the shell pod - Input/output is streamed between the browser and the shell container via the WebSocket
Technical Details
Browser (xterm.js) ↕ WebSocketUI Pod (Go Server) ↕ kubectl exec -itShell Pod (bash)The terminal uses xterm.js for terminal emulation in the browser, providing a full-featured terminal experience including:
- ANSI color support
- Cursor positioning
- Line editing (readline)
- Terminal resizing
Troubleshooting
Terminal not connecting
-
Check that the shell pod is running:
Terminal window kubectl get pods -l app.kubernetes.io/component=shell -
Verify the UI pod has RBAC permissions:
Terminal window kubectl get role,rolebinding -l app.kubernetes.io/instance=<release-name> -
Check UI pod logs:
Terminal window kubectl logs -l app.kubernetes.io/component=ui
Terminal disconnects frequently
This may be due to network timeouts. Check your ingress configuration for WebSocket timeout settings:
ingress: annotations: nginx.ingress.kubernetes.io/proxy-read-timeout: "3600" nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"