PodToast is a Go file/diagnostic agent with an ephemeral-container toolbox for inspecting and operating on running
Kubernetes containers, including distroless and scratch applications. FarshMac
connects to it through an ephemeral container and a persistent Kubernetes exec
stream. No shell, ls, cat, tar, SSH server, service or listening agent port
is needed in the application container.
PodToast is an independent MIT-licensed project, originally developed for
FarshMac. The agent is in cmd/podtoast;
the protocol and client are in internal/podtoast.
Container image: ghcr.io/ikimpriv/podtoast:0.9.1, for Linux amd64 and arm64.
Release tags also update latest; main-branch builds use edge.
See architecture and protocol and security.
- Use
ghcr.io/ikimpriv/podtoast:0.9.1, or a digest-pinned copy in your own registry. The cluster must allow GHCR pulls and the required debug-container permissions. - Select a pod, or enter/select its container, then press Alt+Enter / F11 → Attach ephemeral container… → PodToast. Enter the image, image pull policy and timeout. Select targets with checkboxes; a sole running container is automatic. Shared PID targets reuse one agent.
- Enter the container. Existing viewer/editor, copy, move, local copy/rename, mkdir, delete, chmod, timestamps and symbolic links use PodToast. Transfers retain FarshMac's collision, staging, recovery and metadata policies. Same- container copies stay inside the container; rename uses a filesystem rename.
- The Kubernetes menu also provides PodToast live monitor, PodToast snapshot, and PodToast network / HTTP load test….
Esc cancels file operations and network tests. Esc / Ctrl+C / Cmd+. stops the live monitor. Cancelling one HTTP/2 request does not close unrelated streams. The original shell backend remains available when PodToast has not been started. Once connected, errors do not silently switch backends. Reconnect explicitly when the target restarts or the connection expires (30 minutes idle).
PodToast does not provide a shell to a distroless application. Existing shell commands still require an actual shell in the selected application container.
Alt+Enter or F11 opens the panel/object context menu. On a pod or its container, Attach ephemeral container… offers PodToast, the last 16 successful launch presets, and New image…. Nothing is created until Start / attach is submitted. History retains the image and options across restarts; target pod/container names are not reused across pods. PodToast is an explicit integration role: an arbitrary image is never treated as the agent just because its name contains “podtoast”.
For other images the dialog supports:
- A target container (blank means no target PID namespace; pod networking remains).
- A command as a JSON argv array, e.g.
["/bin/sh"]; blank uses the image entrypoint. Defaultaccess (image/pod defaults),Restricted(non-root, drop capabilities, no privilege escalation, RuntimeDefault seccomp),Network(NET_RAW/NET_ADMIN),Processes(SYS_PTRACE), or explicitPrivilegedaccess. Network/Processes also drop other capabilities, disable privilege escalation and use RuntimeDefault.- An optional run-as UID. Restricted requires a non-root image or nonzero UID.
- Image pull policy: IfNotPresent, Always or Never; 5–600 second startup timeout.
- Interactive TTY and read-only debug-container root switches.
FarshMac attaches to the chosen image's existing entrypoint through Kubernetes attach, rather than launching a second shell. Short-lived commands show their logs and exit code. These images do not enable PodToast file/diagnostic integration. Admission/RBAC failures are reported; profiles are never broadened automatically. Cancelling creation/wait/attach cannot remove a container already accepted by Kubernetes. PodToast keeps its required filesystem-access profile and offers only compatible image, target, pull-policy and startup-timeout settings.
Adding a debugger changes a single-container pod's layout; open panels are remapped to the original container and folder. Window maximize/restore uses Alt+F9.
From the PodToast repository root:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -o /tmp/podtoast-amd64 ./cmd/podtoast
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -trimpath -o /tmp/podtoast-arm64 ./cmd/podtoast
docker build -f Dockerfile -t podtoast:dev .
kind load docker-image --name YOUR_LOCAL_CLUSTER podtoast:devFor a registry, substitute a repository you control:
docker buildx build --platform linux/amd64,linux/arm64 \
-f Dockerfile -t REGISTRY/OWNER/podtoast:VERSION --push .Use the resulting digest in FarshMac for reproducibility. Registry credentials are managed by the pod/cluster image pull configuration, not passed to the agent. The final image contains the static Go agent and an Alpine diagnostic toolbox. FarshMac does not require Docker or kubectl to attach; those tools are only used for building/testing.
Prometheus-format GET /metrics is available over the exec connection, with an
optional dedicated HTTP listener. See metrics specification
for series, scopes, lifecycle and listener configuration.
| Area | Implemented |
|---|---|
| Files | Persistent multiplexed API, directory records streamed in batches of 256, binary streams, regular-file copy within the target, atomic filesystem rename, links, mode and modification time |
| Processes | Visible PID namespace: PID, parent, command name, state, threads, cumulative CPU time, RSS and process start ticks; capped at 16,384 records |
| CPU | Verified target cgroup v2 usage, quota, throttling and pressure; live CPU percentage uses deltas, where 100% is one core |
| Memory | Current/peak/limit, memory breakdown, swap, pressure and OOM counters when exposed by the target cgroup |
| Storage | Root and up to 64 non-pseudo directory mounts: capacity, available bytes, used bytes and inodes; cgroup I/O counters and pressure |
| Network | Pod-scoped TCP/UDP IPv4/IPv6 sockets, states and endpoints (up to 4096 per table), Unix socket table, interface counters, routes, TCP/IP counters and resolver configuration |
| Probes | DNS lookup, TCP connect, HTTP(S) GET and bounded HTTP load test from the pod network |
| Load test | Explicit target, request count, concurrency and global rate; status counts, transport failures, p50/p95/p99 elapsed request latency |
Live monitor shows a compact overview once per second; the JSON snapshot contains
more detail. File browsing remains independent from monitoring and probes.
Counters/tables that the kernel does not expose carry an unavailable reason.
Some diagnostic text files are capped at 64 KiB. The monitor has no growing
history buffer; snapshots and socket/process counts are bounded. Directory
listings are streamed at the agent, but FarshMac still holds the current panel's
entries in memory to sort and display them.
Load tests are HTTP GET only, at most 10,000 requests, 32 workers, 1,000 requests per second and 60 seconds. Individual requests time out after 10 seconds and consume at most 8 MiB of response body. Redirects are not followed; TLS verification is enabled and uses the target root's trust store. HTTP status counts are separate from transport/read failures. Percentiles include completed failed requests; deadline-limited runs report how many requests completed.
- Creation is an explicit user action. It requires access to pods and the
pods/ephemeralcontainerssubresource, pluspods/exec. Admission policies may refuse the requested security context. PodToast never installs a DaemonSet, mounts the host filesystem, uses a runtime socket, or changes cluster RBAC. - The agent runs as root with a writable ephemeral root for shell temporary files, no privilege escalation,
RuntimeDefaultseccomp, all capabilities dropped except SYS_PTRACE, SYS_CHROOT, DAC_OVERRIDE, FOWNER, CHOWN and FSETID. These permit intentional target-root access and file operations; Pod Security Restricted will normally reject this. There is no automatic privileged retry. - The runtime must support
targetContainerName. The agent identifies the target via its runtime ID in/proc/*/cgroup. For a non-shared PID namespace it can use PID 1 after verifying that this is not its own root. Ambiguous shared-PID targets are refused. Host PID/network pods are not supported. - Before serving, the dedicated exec process enters
/proc/PID/rootusing chroot, so absolute symlinks have the application's semantics. Process start time is pinned and checked; a target exit/restart ends the session. Chroot is for path semantics, not an independent security sandbox. Kubernetes RBAC and the debug container security context remain the access boundary. - New files, directories and symlinks use the target process filesystem UID/GID, so running the diagnostic process as root does not leave ordinary application uploads owned by root. This is not preservation of arbitrary source ownership.
- Read-only mounts stay read-only. The generic FarshMac remote transfer layer currently preserves mode and modification time, not all Linux ACLs/xattrs, owner/group or sparse/hard-link topology. Special-file payloads are refused.
- Cgroup metrics are reported only if target membership is verified; cgroup v1 and inaccessible or ambiguous cgroup layouts show unavailable. Process RSS sums must not be mistaken for cgroup memory. Network counters are shared by the pod. Filesystem capacity/usage can be shared with other pods and is not an exclusive container writable-layer or directory size.
- A running matching ephemeral container is reused. Its idle process expires after 24 hours. Disconnecting closes exec sessions, not the idle container. Kubernetes keeps ephemeral-container records until the pod is deleted, and does not restart a terminated ephemeral container. Cancelling startup cannot undo an already accepted creation request.
go test -race ./internal/podtoast
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build ./cmd/podtoast
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build ./cmd/podtoastCI runs native Linux race tests and binary builds on amd64 and arm64.
After tests pass, pushes to main publish edge; version tags such as v0.1.0
publish 0.1.0 and latest. Pull requests test without publishing. Images include
OCI source/license labels, provenance and an SBOM. Publishing uses the scoped
GitHub Actions token; no long-lived registry credentials are required.
FarshMac also maintains a real Kubernetes integration test in podtoast/test.sh:
it covers a distroless target, file operations, metadata, observations, probes,
cancellation and container reuse. It is run from the FarshMac checkout.
These are opportunities, not implemented features:
- Process detail screens: file descriptors with socket-to-PID correlation,
deleted-but-open files, cwd/executable, limits, I/O, signals and namespace IDs.
/procaccess is permission-dependent; environment values should be opt-in because they commonly contain credentials. - Directory watch/inotify updates and agent-side recursive size/search jobs with progress, bounded queues and cancellation. These can remove per-directory network round trips for very large trees.
- Application-specific endpoints: Prometheus/OpenMetrics, Go pprof, JVM metrics and health endpoints. These require the application to expose them.
- Network screens with time-series rates, connection churn, DNS timing, TLS certificate inspection, configurable HTTP methods/headers/bodies and latency histograms. UDP probes and protocol-aware checks need explicit semantics.
- Packet capture and syscall profiling as separate capability profiles. Capture generally needs NET_RAW; ptrace profiling can disturb an application. eBPF often needs node/kernel access and cannot be assumed to work from this profile.
- Exact writable-layer usage, GPU telemetry, host-wide conntrack and historical metrics generally require runtime, node, device or external monitoring access. An ephemeral container alone cannot promise these.
Design references: Kubernetes ephemeral containers, process namespace sharing, Linux cgroup v2.
Version 0.3.1 adds shell utilities. FarshMac runs commands in the ephemeral container, at the target folder shown in the panel. See execution context, target selection and component licenses.
Version 0.7.0 adds passive TCP/UDP connection observation and port-group traffic counters alongside FarshMac's graphical traffic window. Multi-select connections or incoming/outgoing port groups to compare rates. Fault injection is a separate explicit action, retaining the IPv4 TCP proxy and watchdog cleanup from 0.6.0. TLS stays encrypted. See traffic monitoring for scope, privileges and limits.
Directory entries expose the target mount path and filesystem type (0.7.1+). FarshMac combines these with the pod specification: mount points are highlighted and selected entries identify PVCs, disk/RAM emptyDir and other volumes. The agent reads mountinfo once per listing; it does not scan directory trees to guess storage usage.
CPU and memory come directly from verified target cgroups, without metrics-server. Exact Kubernetes ephemeral storage accounting (writable layer, runtime logs and shared disk emptyDir) requires kubelet statistics; a chrooted agent cannot reliably separate image layers or read node-managed logs. statfs capacity is shared filesystem capacity, not container consumption. FarshMac reads kubelet stats via the API server when nodes/proxy access is available. No host mounts or additional privileges are attached automatically.
PodToast collects target cgroup, filesystem-capacity, device, and network-interface
metrics during idle, even with no connected client. It samples every five seconds
and retains up to 20 minutes (241 frames), bounded to 4 MiB of metric text per
target and at most 16 target roots. High cardinality can shorten retention.
Filesystem capacity measures the backing filesystem.
History lives in the toolbox's private /tmp/podtoast-metrics-history directory;
it does not write into target containers or expose a new network listener. The
/metrics/history endpoint is available over the existing target-bound exec stream
(and the optional read-only metrics listener). PID start time prevents history from
being reused after a target restart. Clients replay original timestamps before
live observations. Existing deployed images must be replaced to gain this feature;
older agents still provide live metrics without history.
Directory summaries are computed inside the target root by
GET /v1/directory-summary?path=...&ignoreDSStore=1. The optional
directorySummary capability advertises support. NDJSON frames contain
cumulative file, subdirectory and symlink counts, logical and allocated bytes,
and unreadable-entry counts. A final done frame distinguishes completion from
transport failure. Closing/cancelling the request stops traversal. Symlinks are
not followed; hard links are counted per entry, not as unique physical storage.
Traversal uses bounded batches and a depth limit; inaccessible or excessively
deep branches are reported as unreadable.
Version 0.8.1 supports retiring superseded agents after replacement. The retirement helper runs in the old toolbox, verifies the idle process's root and executable, and uses a Linux pidfd. It waits up to two minutes for other toolbox processes to finish. Busy or unverifiable agents stay running; the application is never sent a signal. Legacy toolbox images with a writable /tmp and /bin/sh can use a temporary helper streamed from the replacement. Terminated ephemeral-container records remain in the Pod.
Version 0.8.2 exports podtoast_memory_working_set_bytes (total minus inactive file cache, clamped at zero), podtoast_memory_anonymous_bytes (application anonymous memory), and podtoast_memory_file_cache_bytes (file cache, including tmpfs/shared memory). podtoast_memory_usage_bytes remains total cgroup usage for compatibility. Working set includes active cache and kernel memory; these series are not additive. Missing memory.stat fields are omitted rather than treated as zero. The autonomous history collector retains all four series.
Run a separate PodToast process with device-metrics to collect DRM counters
from all visible processes. The command only serves GET /metrics. It samples
every five seconds and starts on loopback by default. For Kubernetes, deploy
it explicitly on accelerator nodes with the label
app.kubernetes.io/name: podtoast-device-metrics and a port named metrics.
FarshMac locates this exporter on the selected node via the Kubernetes API.
The example below assumes an image built from this checkout, available from GHCR as
ghcr.io/ikimpriv/podtoast:0.9.1. Apply it in an administrator-managed
namespace. Select only nodes intended for host process monitoring and limit
access to the metrics port with cluster network policy. For NVIDIA, add
--nvidia and use a runtime that gives this collector access to NVIDIA
devices and the driver-provided nvidia-smi/NVML utility. The NVIDIA Container
Toolkit may require setting the runtime class, NVIDIA_VISIBLE_DEVICES=all
and NVIDIA_DRIVER_CAPABILITIES=utility depending on cluster setup. The
exporter can include runtime container IDs for workload attribution.
Some NVML drivers or MIG configurations omit per-process utilization.
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: podtoast-device-metrics
spec:
selector:
matchLabels:
app.kubernetes.io/name: podtoast-device-metrics
template:
metadata:
labels:
app.kubernetes.io/name: podtoast-device-metrics
spec:
hostPID: true
automountServiceAccountToken: false
nodeSelector:
podtoast.dev/device-metrics: "true"
containers:
- name: metrics
image: ghcr.io/ikimpriv/podtoast:0.9.1
imagePullPolicy: IfNotPresent
args: ["device-metrics", "--listen=:9108"]
ports:
- name: metrics
containerPort: 9108
securityContext:
runAsUser: 0
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: ["ALL"]
add: ["SYS_PTRACE"]A workload-scoped PodToast observes DRM counters for verified target processes and includes those samples in its bounded metrics history. It does not need host PID access. The host collector is unnecessary for node-wide GSP usage if the Blaize device plugin already exports per-device utilization.
The device memory gauge reports bytes. PodToast reads GSP memory and supported
NVIDIA VRAM counters from fdinfo alongside engine counters, counting each DRM
client once per device. The node collector prefers fdinfo when both sources
report the device and can use NVML-backed nvidia-smi for whole-device memory
on drivers without fdinfo accounting.