Skip to content

fix(sentry-kube): Make debug containers usable for getsentry pods - #262

Merged
oioki merged 2 commits into
mainfrom
fix/sentry-kube-debug-subpath-mounts
Oct 16, 2026
Merged

oioki merged 2 commits into
mainfrom
fix/sentry-kube-debug-subpath-mounts

Conversation

@oioki

@oioki oioki commented Oct 16, 2026

Copy link
Copy Markdown
Member

Fixes three problems that made sentry-kube debug unusable on getsentry pods such as getsentry-web-symbols-production-canary.

Duplicate mount paths. Ephemeral containers can't use subPath mounts, so debug mounts each whole volume under /subPathMounts/<volume><dir>. When several subPath mounts of the same volume go into the same directory (e.g. k8s_regionsilo_ops.py, kafka_topic_to_cluster.yaml and kafka_cluster_to_brokers.yaml from the getsentry volume), they were all rewritten to the same mountPath, and the API rejected the pod with mountPath: ... must be unique. Each resulting mount is now added only once.

Container exited immediately. With no command, kubectl debug ran the image entrypoint. Sentry then failed to import getsentry.conf.settings.k8s_regionsilo_ops, because the subPath files aren't at their original paths in the debug container, and the container exited before it could be attached. debug now starts sh when no command is given. sh is used rather than bash so that alpine/busybox images work too; pass -- bash explicitly if needed.

No access to the target's filesystem. The target container usually runs as a non-root user, so root in the debug container got Permission denied on /proc/<pid>/root. The debug container now gets SYS_PTRACE by default. You can then use a tool image (e.g. --image debian) and still read the app container's real files, mounts included, under /proc/1/root/.... Making the container privileged by default was considered and rejected, since that grants node-level access for every routine debug session; -p still does that when needed.

🤖 Generated with Claude Code

oioki and others added 2 commits October 16, 2026 13:33
Several subPath mounts of the same volume into the same directory were
rewritten to identical mountPaths, which Kubernetes rejects for the
ephemeral container. Add each resulting mount only once.

Without a command, kubectl debug ran the image entrypoint, which fails
because the subPath files are not linked in place yet, so the debug
container exited immediately. Start sh by default instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The target container usually runs as a non-root user, so root in the
debug container got "Permission denied" on /proc/<pid>/root and could
not browse the target's filesystem. Add SYS_PTRACE by default instead
of requiring a fully privileged container via -p.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oioki
oioki marked this pull request as ready for review October 16, 2026 13:54
@oioki
oioki requested a review from a team as a code owner October 16, 2026 13:54
@oioki
oioki merged commit 99be8ab into main Oct 16, 2026
12 checks passed
@oioki
oioki deleted the fix/sentry-kube-debug-subpath-mounts branch October 16, 2026 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants