Allow removing fields from kubectl debug copied pods or containers #1570
Labels
kind/feature
Categorizes issue or PR as related to a new feature.
priority/backlog
Higher priority than priority/awaiting-more-evidence.
triage/accepted
Indicates an issue or PR is ready to be actively worked on.
What would you like to be added:
A way to remove fields from containers when using
kubectl debug --copy-to
using--custom
patches.Why is this needed:
When using
kubectl debug
with the--copy-to
option, everything from the original pod is copied. In my case, this includes livenessProbe and readinessProbe. In many cases, these probes fail. For instance:--image
or simplyCOMMAND [args...]
)Thanks to KEP-4292 implemented behind a flag here, it is now possible to rewrite fields so we can "disable" probes by setting a very high initial delay instead. It also allows overwriting environment variable and other stuffs. Unfortunately, since we can't unset fields, we can't do things such as adding an
exec
probe to a pod withhttpGet
probe (as it results in a spec with bothhttpGet
andexec
which is invalid)The specific case of probes can be mitigated by using a profile that automatically removes probes (such as
general
) but this introduces some other limitations if your debugging job requires other capabilities.I saw kubernetes/kubernetes#123149 which implements this using
--keep-*
parameters. For my use-case and I would prefer being able to distribute custom profiles as YAML or JSON as it allows non power-user to use different debugging profiles without changing several kubectl arguments.For client-side patching, Strategic Merge Patch directives are used (or used to? I know it exists as well in Kustomize.). Following this document, a patch to remove probes and a specific env variable could look like:
The text was updated successfully, but these errors were encountered: