<p>I have a project that I want to add <code>debug container</code> to <strong>a pod or some pods</strong>, but I don't want the pod to be rebuilt. <code>kubectl patch</code> can be added but the pod will be rebuilt. Is there any other way to achieve this?</p>
<p>I really appreciate any help with this.</p>

moluzhui
<p>Then you are looking for <a href="https://kubernetes.io/docs/concepts/workloads/pods/ephemeral-containers/" rel="nofollow noreferrer">ephemeral-containers</a>. It was introduced in k8s <code>v1.16</code> as an alpha feature and became beta in k8s <code>v1.23</code>.</p>
<p><strong>Ref:</strong></p>
<ul>
<li><a href="https://kubernetes.io/docs/tasks/debug-application-cluster/debug-running-pod/#ephemeral-container" rel="nofollow noreferrer">Debugging with an ephemeral debug container</a>.</li>
</ul>
