Skip to content

fix(k8s): set containerSecurityContext for mattermost #2937

Closed

Description

@dan-petty

Problem

The Mattermost application pod cannot start in namespace mattermost.
The replicaset controller reports this error:
Error creating: pods "mattermost-578c98b7c7-lbts5" is forbidden: violates PodSecurity "restricted:latest": allowPrivilegeEscalation != false (container "mattermost" must set securityContext.allowPrivilegeEscalation=false), unrestricted capabilities (container "mattermost" must set securityContext.capabilities.drop=["ALL"]).

Cause

The namespace mattermost enforces the restricted Pod Security standard.
The manifest k8s/mattermost/mattermost.yaml defines podTemplate.securityContext but omits podTemplate.containerSecurityContext.
The Mattermost Operator therefore generates a Deployment whose container lacks allowPrivilegeEscalation: false and capabilities.drop: ["ALL"].

Solution

Configure containerSecurityContext under spec.podTemplate in k8s/mattermost/mattermost.yaml:

  • Set allowPrivilegeEscalation: false
  • Set capabilities.drop: ["ALL"]
    Add an invariant test in tests/invariants/test_k8s_argocd_apps.py to prevent regressions.

Activity

  1. added
    source/agent
    type/bug
    scope/k8s
    status/new
    value/medium
    effort/low
    on Oct 31, 2026
  2. dan-petty commented on Oct 31, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: scope/k8s. The (k8s) scope of the title gives the scope.
    • Priority: P2-Medium. The mattermost pod cannot start at all, blocking that service, but other services are unaffected.
    • Value: Medium. It unblocks the mattermost application in the mattermost namespace for users who depend on it.
    • Effort: Low. Adding two fields to one YAML file and one invariant test is a small change.
    • Related: fix(k8s): specify runAsUser for mattermost-operator #2932, which asks for a different change. Both fix a PodSecurity admission failure in the mattermost namespace, but 2932 sets runAsUser for the operator while this sets allowPrivilegeEscalation and capabilities for the app container.
  3. added
    priority/p2-medium
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Oct 31, 2026
  4. removed
    status/in-review
    on Oct 31, 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

    effort/lowpriority/p2-mediumscope/k8ssource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions