docs/design/troubleshooting.md
This design document is a proposal to consolidate application troubleshooting features in Dashboard.
The Kubernetes command line interface has several features for inspecting applications running in Pods. Some examples are as follows.
Troubleshooting and debugging have consistently been a top priority from a user's point of view. See:
Use cases for opening a terminal session are numerous and highly application specific. The use cases are similar to use cases for opening an SSH session to a server.
Some generic use cases include but are not limited to:
The basis of the design is adding one new feature and updating the UI so that troubleshooting features are logically grouped.
The UI will be improved to add tabs to a pod detail page. The tabs will include:
End users can switch between the Details, Logs, and Terminal tabs without reloading the page. Users can switch tabs without ending an existing terminal session. This is important so that users can view logs or detailed pod information without losing their work in the terminal.
The "Details" tab is equivalent to the existing Pod details page. It includes "Details", "Containers", "Conditions", "Created by".
The Logs tab is equivalent to the existing Logs page.
The terminal will allow users to execute arbitrary commands inside a container. When a user switches to the Terminal tab for the first time, Dashboard will establish a terminal session. The terminal will attempt to run the standard '/bin/sh' shell command in the container. If '/bin/sh' is present and executable users can use it to execute arbitrary commands in the shell environment.
The terminal will allow the user to switch between containers in the pod. Dashboard will also show the status of the session. Dashboard will indicate when the user is disconnected and allow them to reconnect.
If the '/bin/sh' command is not present, the terminal will detect this and drop the user into a pseudo-terminal that runs in the browser. The pseudo-terminal allows users to run commands in the container without having '/bin/sh' installed.
.
The Kubernetes API for running commands requires the executed command to be in list format. The pseudo-terminal will take the commands as the user types them and perform simple shell escaping to break the full command into its arguments.
Several other UIs have similar troubleshooting features.
The terminal feature was heavily influenced by the terminal feature in OpenShift. OpenShift's terminal runs the '/bin/sh' command automatically as outlined in this document, however it does not allow running of commands if the '/bin/sh' command is not present in the container.
Cabin is a mobile application for interacting with a Kubernetes cluster. Cabin includes an exec feature that allows the user to execute commands in containers. Cabin allows the execution of commands but does not support running the command in a tty or piping stdin to the container.