Skip to content

kubectl debug: Extend --keep-labels flag to Ephemeral Container #1836

@mochizuki875

Description

@mochizuki875

What would you like to be added:
We have added the --keep-labels flag to Copy Pod(created by --copy-to) to control the removal of labels inherited from the original pod.(kubernetes/kubernetes#123149)
My suggestion is to extend this flag to Ephemeral Container.

Why is this needed:
In short, the purpose is it makes possible to isolate the target pod from ReplicaSet or Service and add an Ephemeral Container to it seamlessly by setting --keep-labels=false.

When we use kubectl debug to add Ephemeral Container to the target pod, Ephemeral Container will be directry added to the target pod.
However, it can sometimes be undesirable.
For example:

Additionally, when using Copy Pod instead of Ephemeral Container, the pod will be recreated and dynamic information of the target pod (e.g. in-memory information) will be lost.

For these issues, isolating the target pod by removing labels has been known as a method.

By extending --keep-labels flag to Ephemeral Container and indicating --keep-labels=false, we can isolate target pod and add Ephemeral Container to it in a single operation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions