Skip to content

Chart: add pod-level securityContext (podSecurityContext) for all workloads #8114

Open

Description

@DrFaust92

Proposed Feature

Add a pod-level security context to the chart: global.podSecurityContext plus a per-component podSecurityContext (api, controller, management controller, both webhooks servers, garbage collector, Dex, bundled PostgreSQL, migrations), rendered into spec.template.spec.securityContext. This mirrors the existing securityContext / global.securityContext pattern, which today only reaches the container-level securityContext.

Default it to {}, so rendered manifests don't change unless a user sets it.

Motivation and Use Case

Some settings only exist at pod level, or are much simpler to set there, and the chart currently has no way to set them:

  • fsGroup / fsGroupChangePolicy: needed when the bundled PostgreSQL runs as non-root on a PVC, so the data directory is writable.
  • seccompProfile: RuntimeDefault for the whole pod, including init containers such as the CA-bundle init container, which doesn't use the component's container-level securityContext.
  • runAsNonRoot / runAsUser / runAsGroup / supplementalGroups applied to every container in the pod.
  • sysctls and similar pod-only fields.

Pod Security Admission restricted checks some of these at pod level, and the usual workaround is post-rendering.

Alternatives Considered

  • Tightening the default container securityContext (runAsNonRoot, capabilities.drop: [ALL], readOnlyRootFilesystem, seccompProfile): stronger, but it changes behaviour and could break the bundled PostgreSQL and user-supplied sidecars, so it's better as a separate discussion.
  • Post-rendering with kustomize: works, but every user has to repeat it.

Activity

  1. added
    needs/area
    needs/kind
    needs/priority
    on Nov 22, 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

    needs/areaneeds/kindneeds/priority

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions