-
Notifications
You must be signed in to change notification settings - Fork 41.1k
kubectl attach: include namespace flag in reattach messages #133404
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
base: master
Are you sure you want to change the base?
kubectl attach: include namespace flag in reattach messages #133404
Conversation
When a pod is not in the default namespace, the reattach message generated after an attach session ends now includes the -n flag with the namespace name. This ensures the suggested command will work correctly for pods in non-default namespaces. Before: Session ended, resume using 'kubectl attach pod-name -c container -i -t' After: Session ended, resume using 'kubectl attach -n custom-ns pod-name -c container -i -t'
Please note that we're already in Test Freeze for the Fast forwards are scheduled to happen every 6 hours, whereas the most recent run was: Wed Aug 6 20:56:47 UTC 2025. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: matucker-msft The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The 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-sigs/prow repository. |
Welcome @matucker-msft! |
Hi @matucker-msft. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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-sigs/prow repository. |
What type of PR is this?
/kind bug
What this PR does / why we need it:
When a pod is not in the default namespace, the reattach message generated after an attach session ends now includes the -n flag with the namespace name. This ensures the suggested command will work correctly for pods in non-default namespaces.
Before:
Session ended, resume using 'kubectl attach pod-name -c container -i -t'
After:
Session ended, resume using 'kubectl attach -n custom-ns pod-name -c container -i -t'
Which issue(s) this PR is related to:
N/A
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Yes