ko
ko copied to clipboard
Idea: include debug variant images, `ko debug`
⚠️ I'm not sure this is a good idea, but it's something I thought of, and I'm curious for feedback.
Basing images on distroless/static is great (don't get me started), but it means folks who want to debug things won't have a shell if they want to kubectl exec
in and poke around.
What if ko
built two images for each platform, one based on distroless/static and one based on a (configurable) debug variant which includes a shell. ko
would need to make sure to put the "real" image first in the manifest list, so container runtimes don't accidentally pick up the debug variant all the time, since both images would have the same platform
value.
Then we could have some UX for swapping out the "real" variant with its debug counterpart, e.g., ko debug <pod>
, where it would look into the Pod for any ko
-built images, and update the podspec's image
s (which is allowed, surprisingly!). This unfortunately restarts the container with the new image, but it would restart it with a new debuggable image. ko debug
could even wrap the kubectl exec
part, and swap the image back when you're done. Mischief managed. 🪄
I also have no idea how this would work with Windows, so let's just ignore that.
Ephemeral containers are supposed to be the answer for this, but unfortunately they're still in beta so they're not available many places in the wild.
cc @jedsalazar who made me think about this
This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Keep fresh with the 'lifecycle/frozen' label.
Any chance this can be reconsidered?