Skip to content

fix(k8s): tempo runs under the otel namespace's restricted pod security, so traces reach their volume #1627

Closed

Description

@dan-petty

Regression of #1135 (shipped in v0.2.35): the tempo pod has never been admitted.

Friction

Traces have never been stored. #1135 (v0.2.35) shipped Grafana Tempo in namespace otel, but the namespace enforces PodSecurity restricted and k8s/otel/tempo-values.yaml sets no restricted securityContext. The API server refuses every tempo-0 pod, so the StatefulSet has run 0 of 1 replicas since it was deployed. The feature #1135 delivered is a regression from day one, and no check caught it before or after the merge.

Evidence

Live, read-only, 2026-10-17 and 2026-10-18 (main = 3dd7fa6):

  • Namespace otel carries pod-security.kubernetes.io/enforce=restricted (also audit and warn).
  • StatefulSet otel/tempo (chart tempo 3.1.0 from grafana-community, image docker.io/grafana/tempo:3.1.0, Argo CD Application tempo Synced) reports replicas 0, availableReplicas 0.
  • Event FailedCreate on otel/tempo, count 373 by 2026-10-18T01:00Z: pods "tempo-0" is forbidden: violates PodSecurity "restricted:latest": allowPrivilegeEscalation != false (container "tempo" must set securityContext.allowPrivilegeEscalation=false), unrestricted capabilities ..., plus the seccompProfile requirement.
  • PVC otel/storage-tempo-0 is Pending (WaitForFirstConsumer, no pod ever scheduled).
  • Collector side: increase(otelcol_exporter_sent_spans{exporter="otlp_grpc/tempo"}[4d]) = 0, send_failed_spans = 20,869, and the exporter's sending queue is at 100% capacity. Grafana's Tempo datasource health check gets "connection refused".

Repo:

  • k8s/otel/tempo-values.yaml:1-81 sets no securityContext and no tempo.securityContext.
  • Chart 3.1.0 defaults (helm show values grafana-community/tempo --version 3.1.0): pod securityContext = runAsUser/runAsGroup/fsGroup 10001, runAsNonRoot true, with no seccompProfile; container tempo.securityContext: {}. The rendered StatefulSet has a single container, tempo (tempoQuery is not rendered).
  • k8s/argocd/apps/tempo.yaml:11-13 pins the chart; tests/test_k8s_tempo.py:17 (test_tempo_stack_contract_and_datasource_links) pins the chart and datasource links but nothing about pod security.
  • A throwaway manifest with the fix below passed kubectl apply --dry-run=server in namespace otel (proven during this audit).

Remedy

Tests first, then values; deployed by Argo CD Application tempo (and deploy-stack's tempo release, which reads the same values file).

  1. Extend tests/test_k8s_tempo.py with one structural-tuple assertion over k8s/otel/tempo-values.yaml: pod securityContext.seccompProfile.type == "RuntimeDefault" and runAsNonRoot is True; tempo.securityContext has allowPrivilegeEscalation is False, capabilities.drop == ["ALL"] and readOnlyRootFilesystem is True. It fails today.
  2. In k8s/otel/tempo-values.yaml, set the pod securityContext (keep the chart's runAsUser/runAsGroup/fsGroup 10001 and runAsNonRoot true; Helm merges maps, but state them so the test pins them) with seccompProfile: {type: RuntimeDefault}, and set tempo.securityContext to allowPrivilegeEscalation: false, capabilities: {drop: [ALL]}, readOnlyRootFilesystem: true. Tempo writes only under /var/tempo, which is the PVC mount. Do not relax the namespace's restricted level.
  3. Add a guard so the next chart in a restricted namespace cannot ship the same way: a test that, for every Helm release whose namespace k8s/namespaces.yaml labels restricted, asserts its values file sets the restricted container fields (or names a reviewed exemption). The general render-and-admit check belongs with feat(release): a release is cut only after every argo cd application builds at the release head and its live changes are shown #1343, which builds every Application at the release head; link it there rather than adding a network call to the test suite.
  4. changelog.d/<issue>.md under ### Fixed, citing feat(telemetry): traces are stored in tempo on a volume, and grafana and devops-cli read them, linked to logs and profiles #1135.

Verification after Argo CD syncs main (a person or an agent, read-only):

  • kubectl -n otel get sts tempo shows 1/1 and kubectl -n otel get pvc storage-tempo-0 shows Bound.
  • increase(otelcol_exporter_sent_spans{exporter="otlp_grpc/tempo"}[15m]) > 0 and send_failed stops increasing; the queue drains.
  • Grafana's Tempo datasource health check passes, and a devops-cli trace is found by TraceQL.
  • If readOnlyRootFilesystem breaks start-up, add an emptyDir for the path Tempo names in its error through tempo.extraVolumeMounts, rather than dropping the setting.

Priority: P0. A feature shipped in v0.2.35 (#1135) has never run; this is its regression fix.

Activity

  1. added this to the v0.2.37 milestone on Oct 18, 2026
  2. added
    type/bug
    scope/k8s
    priority/p0-critical
    status/in-progress
    on Oct 18, 2026
  3. added a commit that references this issue on Oct 18, 2026
    bfb312a
  4. dan-petty commented on Oct 18, 2026

    @dan-petty
    OwnerAuthor

    What changed

    #1633, merged into release/v0.2.37 as bfb312a.

    Tempo trace storage, shipped in v0.2.35 by #1135, has never run. The otel namespace enforces PodSecurity restricted (k8s/namespaces.yaml), and k8s/otel/tempo-values.yaml set no seccomp profile on the pod and no container security context. Admission therefore refused every pod the tempo StatefulSet created: 343 FailedCreate events over 3 days 17 hours, with storage-tempo-0 left Pending. Argo CD showed the application as Progressing rather than Degraded, and Alertmanager has no receiver yet, so nothing reported it. The homelab audit of 2026-10-18 found it.

    The values now set what restricted requires. The pod runs as the chart's non-root user (10001) with the RuntimeDefault seccomp profile. The tempo container has allowPrivilegeEscalation: false and capabilities.drop: [ALL], and keeps readOnlyRootFilesystem: true, which the chart's own comment recommends for this container. Tempo writes only under its /var/tempo volume (storage.trace.local.path and storage.trace.wal.path); the metrics generator, which would write under /tmp/tempo, stays disabled, and the new test pins that.

    A second commit regenerates docs/MCP_TOOLS.md. #1619 builds each tool's description from its Typer command, and #1620 and #1621 changed the pr check-readiness docstring; each passed devops docs check on its own base, so release/v0.2.37 carries a stale file and the check fails on every branch cut from it.

    5 file(s) changed.

    How it was verified

    Check runs at 701ccf1:

    • Audit Defect PR Hardening: skipping
    • Prune PR DevContainer Images: pass
    • devops-cli: pass
    • zizmor: pass
    • bandit: pass
    • CodeQL: pass
    • Changed-Test Independence: pass
    • Analyze (python): pass
    • Rule Pack Tests: pass
    • Fail-to-Pass Check: pass
    • Fail-to-Pass Self-Check: pass
    • Tests & Coverage: pass
    • Analyze (actions): pass
    • Static Analysis: pass
    • Dependency Freshness: skipping
    • Service Image: skipping
    • DevContainer Image: skipping

    Acceptance Criteria of docs/agent/tasks/task-1627-tempo-pod-security.md:

    • The values set every control PodSecurity restricted requires (test_tempo_pod_meets_the_otel_namespaces_restricted_pod_security).
    • The pod the values render is admitted by a server-side dry run into otel, and the previous values are refused.
    • Pending a person: after the release reaches main and Argo CD syncs tempo, kubectl -n otel get pod tempo-0 is Running and the storage-tempo-0 claim is Bound.
  5. added a commit that references this issue on Oct 20, 2026
    954914e
  6. removed
    status/in-progress
    on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/p0-criticalscope/k8stype/bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions