-
Notifications
You must be signed in to change notification settings - Fork 39.7k
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
kubectl debug: support debugging nodes #92310
Conversation
1c3bcc5
to
c4398ad
Compare
names[ref.Name] = ref | ||
} | ||
for i := range pod.Spec.InitContainers { | ||
ref := &pod.Spec.Containers[i] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a typo here ?
In worst case, there may be index out of bounds exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few nits
The action taken by 'debug' varies depending on what resource is specified. Supported | ||
actions include: | ||
|
||
* Pod: Create a copy of an existing pod with certain attributes changed, for example |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd call it workload, since it's not a problem to get a pod from a deployment/daemon set/job, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sense, and it might be nice to support automatically resolving simple workloads to pods. Updated.
@@ -221,6 +241,11 @@ func (o *DebugOptions) Validate(cmd *cobra.Command) error { | |||
return fmt.Errorf("invalid image pull policy: %s", o.PullPolicy) | |||
} | |||
|
|||
// Target | |||
if len(o.Target) > 0 && len(o.CopyTo) > 0 { | |||
return fmt.Errorf("--target incompatible with --copy-to. Use --share-processes instead.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is incompatible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
if err != nil { | ||
return nil, "", err | ||
} | ||
klog.V(2).Infof("node debugPod create returned pod: %#v", newPod) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug message, I'd remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
TTY: o.TTY, | ||
VolumeMounts: []corev1.VolumeMount{ | ||
{ | ||
MountPath: "/node", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: aybe just /host
here, and host
below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM. I've updated this and the other messages to use "node" only in the context of the API object and "host" in the context of namespaces and filesystem. Now that you point it out, I realize this is more in line with how these terms are used in the rest of the API.
d60f19b
to
c1086c6
Compare
When called with a node target, `kubectl debug` will create a run-once pod in the target node's namespaces.
c1086c6
to
7e63cc8
Compare
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
/milestone v1.19
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: soltysh, verb The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest Review the full test history for this PR. Silence the bot with an |
/retest |
/retest Review the full test history for this PR. Silence the bot with an |
2 similar comments
/retest Review the full test history for this PR. Silence the bot with an |
/retest Review the full test history for this PR. Silence the bot with an |
/retest |
/retest Review the full test history for this PR. Silence the bot with an |
1 similar comment
/retest Review the full test history for this PR. Silence the bot with an |
/retest |
1 similar comment
/retest |
/retest Review the full test history for this PR. Silence the bot with an |
2 similar comments
/retest Review the full test history for this PR. Silence the bot with an |
/retest Review the full test history for this PR. Silence the bot with an |
@verb: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
/retest Review the full test history for this PR. Silence the bot with an |
What type of PR is this?
/kind feature
/sig cli
/priority important-longterm
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #89306
Special notes for your reviewer: This PR includes commits from #90094 and should not merge prior to it. To see the changes introduced by this change alone, use the individual commits view.
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: