0

I have a project that I want to add debug container to a pod or some pods, but I don't want the pod to be rebuilt. kubectl patch can be added but the pod will be rebuilt. Is there any other way to achieve this?

I really appreciate any help with this.

moluzhui
  • 1,003
  • 14
  • 34

1 Answers1

2

Then you are looking for ephemeral-containers. It was introduced in k8s v1.16 as an alpha feature and became beta in k8s v1.23.

Ref:

Kamol Hasan
  • 12,218
  • 1
  • 37
  • 46
  • Thank you, this feature may not work with v1.18. Is there any other plan? – moluzhui Dec 23 '21 at 10:05
  • This feature will work with v1.18. – Kamol Hasan Dec 23 '21 at 10:09
  • Yes, when I enabled the alpha feature, I could add ephemeral-containers via `kubectl alpha debug`, but when I finished debugging there seemed to be **no way to remove it** – moluzhui Dec 23 '21 at 11:00
  • @moluzhui Yes, you cannot remove it in k8s v1.18. The support for removal is added in v1.23. [Issue Link](https://github.com/kubernetes/kubernetes/issues/84764) – Kamol Hasan Dec 23 '21 at 11:52