Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk3 min

Distroless Pods: Get a Debug Shell and Know What It Can See

A distroless image may have no shell for kubectl exec. Use kubectl debug for a separate troubleshooting shell, but understand the limits on process and filesystem visibility.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

kubectl exec -it POD -- sh fails when the application image does not contain sh. To troubleshoot without rebuilding or restarting that container, use kubectl debug to add a separate ephemeral container with its own shell and tools. It can sometimes see the target container’s processes, but that depends on Pod namespace configuration and container-runtime support; it does not add a shell to the application image or guarantee access to its filesystem.

Why kubectl exec -- sh fails

Distroless runtime images contain an application and its runtime dependencies, but omit shells and the usual distribution utilities. If the image has no sh executable, kubectl exec -it POD -- sh has nothing to launch. That is a limitation of the image contents, not a special restriction imposed by kubectl exec. The Distroless project describes these images as containing only the application and runtime dependencies.

As an Amazon Associate I earn from qualifying purchases.

Kubernetes identifies this as a use case for ephemeral containers: interactive troubleshooting when kubectl exec is insufficient because an image lacks debugging utilities. The feature has been Stable since Kubernetes v1.25, according to the Kubernetes documentation.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Start a shell in an ephemeral debug container

An ephemeral container is a separate container added to an existing Pod for troubleshooting. It has its own image, filesystem, shell, and diagnostic utilities. The application container remains the same; the debug container does not install a shell into it.

#1 Best Overall
kubectl debug -it POD --image=busybox --target=APP_CONTAINER

Replace POD with the Pod name and APP_CONTAINER with the application container’s name. Choose a debug image that actually contains the shell and utilities you need. In this command, --image selects that image, while --target requests targeting the named container’s namespaces. Kubernetes documents this pattern in its running-Pod debugging guide.

The Distroless project also publishes :debug image variants that include a BusyBox shell. Those variants can be useful when building or testing a debug image; they are distinct from adding an ephemeral container to an already-running Pod.

What the debug container can—and cannot—see

Processes: possible, not guaranteed

--target asks the runtime to place the debug container in the target container’s namespaces so that tools such as ps may show its processes. Kubernetes says this targeting depends on container-runtime support. Without that support, the debug container may fail to start or may start with an isolated process namespace, leaving the target’s processes invisible.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check the Pod’s process-namespace setup and the runtime’s behavior before treating an empty process listing as evidence that the application is not running. Process visibility is conditional, not a guarantee of the command.

Files and internal state: no automatic access

The debug container has its own filesystem and toolset. The documented workflow provides a troubleshooting environment; it does not promise that the target container’s complete filesystem or internal state becomes available. Do not assume that adding an ephemeral container mounts the application’s files into it.

Capabilities: constrained by the Pod’s security configuration

Tools and permissions depend on the debug image, the container configuration and the Pod’s security context. Kubernetes notes that some debug-profile capabilities may not work when the entire target Pod is configured to run as a non-root user. A profile does not automatically bypass the Pod’s security settings.

When to choose another debugging mode

Method Where it runs What changes Useful distinction
Ephemeral container Inside the existing Pod Adds a separate troubleshooting container Keeps the Pod under investigation; process visibility depends on namespace and runtime support.
Pod copy In a separate copied Pod Creates another Pod with selected changes, such as a different image or command Useful when changing the troubleshooting environment; it is not the same running Pod.
Node debugging In a debugging Pod using the node’s host namespaces Mounts the host filesystem at /host For node-level investigation rather than inspecting only an application container.

These modes and their options are described in the Kubernetes debugging guide. Use a Pod copy when the original Pod should remain untouched or when a changed image or command is needed. Use node debugging when the problem is at the node level.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Know the limits before adding an ephemeral container

Ephemeral containers are intended for troubleshooting, not ordinary application workloads. Kubernetes documents several operational limits:

  • They do not have automatic restart guarantees.
  • Once added, they cannot be changed or removed.
  • They cannot specify fields such as ports, liveness or readiness probes, or resource requests; Pod resource allocations are immutable.
  • They are not supported for static Pods.

Check the Kubernetes documentation and the behavior of your cluster’s actual kubectl release and container runtime before relying on a particular targeting or profile capability.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.