Overview
The Dashboard terminal uses WebSocket connections (via SockJS) to establish interactive shell sessions with your containers. This provides:- Interactive shell access (bash, sh, powershell, cmd)
- Real-time command execution
- Terminal resizing and scrolling
- Multiple concurrent sessions
- Secure communication over HTTPS
Shell access requires the container to have a shell binary installed. Common shells include
bash, sh, powershell, and cmd.Accessing the Terminal
There are multiple ways to open a shell session:- From Pod Detail
- From Pod List
- From Container View
- Navigate to Workloads → Pods
- Click on a pod name
- Click the Exec button in the action bar
- Select the target container
Terminal Interface
The Dashboard terminal provides a full-featured shell environment:Features
Interactive Shell
Full TTY support with command history and tab completion
Terminal Resize
Automatically adapts to browser window size
Copy/Paste
Standard clipboard operations for commands and output
Scrollback
Scroll through command history and output
Keyboard Shortcuts
- Ctrl+C: Send interrupt signal (SIGINT)
- Ctrl+D: Send EOF signal (exit shell)
- Ctrl+L: Clear terminal screen
- Arrow Up/Down: Navigate command history
- Tab: Autocomplete commands and paths
Terminal Implementation
Dashboard implements terminal access using WebSockets and the Kubernetes exec API.Session Management
Terminal sessions are managed via SockJS connections (modules/api/pkg/handler/terminal.go:49-69):
Message Protocol
The terminal uses a message-based protocol:| Operation | Direction | Fields | Description |
|---|---|---|---|
bind | Frontend → Backend | SessionID | Bind SockJS session to terminal |
stdin | Frontend → Backend | Data | User keystrokes and input |
resize | Frontend → Backend | Rows, Cols | Terminal window resized |
stdout | Backend → Frontend | Data | Process output |
toast | Backend → Frontend | Data | Out-of-band messages |
Shell Detection
Dashboard automatically detects available shells (modules/api/pkg/handler/terminal.go:271-305):
If no shell is specified, Dashboard tries shells in order:
bash, sh, powershell, cmd.Process Execution
The terminal establishes a SPDY connection to the Kubernetes API (modules/api/pkg/handler/terminal.go:216-255):
Common Use Cases
Debugging Application Issues
Inspecting Container State
Common inspection commands:Testing Configuration Changes
Test configuration before deploying:Installing Debug Tools
Install troubleshooting utilities temporarily:Security Considerations
RBAC Permissions Required
RBAC Permissions Required
Shell access requires the Verify permissions:
pods/exec permission:Use HTTPS Only
Use HTTPS Only
Terminal sessions should only be accessed over HTTPS to prevent command interception. The WebSocket connection inherits the HTTP(S) protocol.
Audit Exec Access
Audit Exec Access
Enable audit logging to track exec sessions:
Limit Exec Permissions
Limit Exec Permissions
Grant exec permissions only to trusted users and service accounts. Consider using Pod Security Policies or admission controllers to restrict exec access.
Troubleshooting
Terminal connection fails
Terminal connection fails
Check WebSocket connectivity:
Ensure your network allows WebSocket connections and that no proxies are interfering.Verify pod status:The pod must be in “Running” state.Check container status:
Ensure the container is running and healthy:
No shell available
No shell available
Error: “Process exited” or connection immediately closes.Cause: The container doesn’t have a shell binary.Solution: Use a debug container or update your image:Or use ephemeral debug containers (Kubernetes 1.23+):
Terminal appears frozen
Terminal appears frozen
Check for blocking commands:
Some commands may block indefinitely. Press
Ctrl+C to interrupt.Verify network connectivity:
Test the WebSocket connection by closing and reopening the terminal.Check browser console:
Look for JavaScript errors or WebSocket connection issues.Permission denied errors
Permission denied errors
Check RBAC permissions:Check pod security context:
Some pods run as non-root users with restricted permissions. Use
sudo if available, or exec as root:Terminal Limitations
Be aware of Dashboard terminal limitations:- No file upload: Cannot upload files directly (use
kubectl cpinstead) - No session persistence: Sessions close when browser tab closes
- No multiplexing: One terminal per browser tab
- Limited scrollback: Browser memory constraints
Best Practices
Use read-only operations
Use read-only operations
Prefer inspection over modification:Make permanent changes via updated container images or ConfigMaps.
Document your debugging steps
Document your debugging steps
Keep notes of commands and findings for future reference and team collaboration.
Clean up test data
Clean up test data
Remove temporary files created during debugging:
Use ephemeral debug containers
Use ephemeral debug containers
For distroless or minimal images, use debug containers instead of modifying running containers:
Advanced Usage
Specifying Shell
Request a specific shell via URL parameter:bash: Bourne Again Shellsh: POSIX shellpowershell: Windows PowerShellcmd: Windows Command Prompt
Session Timeout
Sessions automatically close after 10 seconds if the WebSocket connection isn’t established (modules/api/pkg/handler/terminal.go:314-318):
Next Steps
Viewing Logs
Access container logs for debugging
Managing Resources
Learn about resource management