-
Notifications
You must be signed in to change notification settings - Fork 921
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: detach-keys option/setting for pod terminal #1011
Comments
Sorry this keeps getting closed. We will certainly accept a PR on this if anyone wants to pick it up. /triage accepted cc @her |
@eddiezane: Please ensure the request meets the requirements listed here. If this request no longer meets these requirements, the label can be removed In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/lifecycle frozen |
Looks like this is a huge change, since kubernetes doesn't prepared for detach keys for now. This cannot achived by simply adding options to cli. I propose close this issue and reopen in kubernetes. https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/cri/streaming/server.go#L65 *pls point out if i'm wrong, thanks! |
It is a pity CRI doesn't seem to consider detach keys. Support would seem to be straightforward for dockershim: |
@book987 @mthome There is already an issue in Kubernetes for this feature, but it got closed as stale (as did #693 and #878 here). If you can get it re-opened and linked, that would be great. We should not close the issue here, because even after support is added in |
As a workaround, create the pod using |
This issue has not been updated in over 1 year, and should be re-triaged. You can:
For more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/ /remove-triage accepted |
@eddiezane: Please see my updates to the Feature Request and add |
This is a revival of #693 which was sort of duplicated by #878 but both went stale before being addressed. #878 labeled this behavior a bug and put it on the backlog. I consider it a feature request, but am happy to let SIGCLI decide.
See Update 2023-04-04 below
kubectl run -it
,kubectl exec -it
, andkubectl attach -it
connect to a Docker container in a manner parallel todocker run -it
anddocker attach
. All these commands by default listen for the key sequencectrl-p,ctrl-q
to cause the command to detach from the container. However, unlikekubectl
, thedocker
commands have a [--detach-keys
option] and configuration property to allow you to specify an alternate key sequence to use instead of the default.kubectl
is missing this option. Please implement it.The default is problematic with
bash
because by default,ctrl-p
on thebash
command line brings up the previous command from the history list. Users typingctrl-p
once expect to see the previous command, but get nothing until they type another character, because thectrl-p
(being the first character in a potential 2-character command) is held back until the next character is sent. If the next character isctrl-q
the connection is closed and the container never sees thectrl-p
. If the next character is something else, then thectrl-p
and the next character are sent as soon as the second character is typed. If that character isctrl-p
, then the user will get the to see the command before the previous command, as they have just typedctrl-p,ctrl-p
. So getting to the immediately previous command requires typingctrl-p
followed by some other character that will not alter the command line. This is annoying at best.Whatever issues people may have with the default detach key sequence in
docker
are alleviated by the presence of the--detach-keys
option and thedetachKeys
property of thedocker
configuration. Howeverkubectl
does not have this option.Please add a
--detach-keys
option that operates the same way asdocker --detach-keys
does.Update 2023-04-04
Although the latest (v1.26) documentation still says you can detach using Ctrl+P,Ctrl+Q, this no longer seems to be the case. It seems you have to kill the attached process or close the connection with Ctrl+D. Why this is or what changed is not documented. So this is now also a request to update the documentation to reflect current behavior and to show the recommended way to end a session.
See also:
The text was updated successfully, but these errors were encountered: