Skip to content

feat(k8s): add the danielpetty-com-pixelfed namespace and Secrets #6645

Closed as not planned

Description

@dan-petty

Problem

Checked at devops-cli main 3f8f7a9.

  • The site dan-petty/danielpetty.com includes Pixelfed (owner decision 2026-11-21). It runs on the cluster after the event-stream, at pixelfed-danielpetty-com.<domain>, one label under the zone.
  • The Pixelfed image ghcr.io/jippi/docker-pixelfed cannot meet Pod Security restricted. At tag v0.15.2-docker0, its runtime stages end with USER root (docker/Dockerfile); the entrypoint changes file owners (docker/rootfs/shared/docker/entrypoint.d/01-permissions.sh), renders templates into /etc and changes the user with su (docker/rootfs/shared/docker/helpers.sh:62-95); Apache listens on port 80.
  • Namespace danielpetty-com enforces restricted (feat(k8s): add the danielpetty-com namespace, project and Secret row #6642) and must keep it for the event-stream. Pod Security is a namespace setting.
  • Pixelfed needs APP_KEY and a Valkey password. Laravel takes a 32-character raw key for AES-256-CBC. SecretGenerator(encoding="urlsafe", nbytes=24) gives 32 characters (src/devops_cli/k8s/cluster_secrets.py:131-142), so the generator needs no change. A new APP_KEY makes the stored encrypted data unreadable, so the value must never change after the first push.
  • The CloudNativePG operator makes the database Secret pixelfed-db-app itself (k8s/README.md:120), so the database needs no row. The operator also writes ConfigMap cnpg-default-monitoring, which project homelab ignores as an orphan (k8s/argocd/apps/projects.yaml:101).
  • push-secrets skips each row whose namespace does not exist (src/devops_cli/k8s/secret_push.py:453-470), and deploy-stack pushes a detached stack only where a namespace with the name of the stack exists (src/devops_cli/commands/k8s/stack_lifecycle.py:892-905). So the Pixelfed rows go in their own stack, named after their namespace.
  • Alloy reaches only the namespaces and ports of monitoring-default-perimeter (k8s/monitoring/networkpolicy.yaml).

Proposed remedy

  • k8s/namespaces.yaml: namespace danielpetty-com-pixelfed with Pod Security enforce baseline, warn and audit restricted, and Prune=false,Delete=false. A comment gives the reason and the upstream files above.
  • AppProject danielpetty-com (feat(k8s): add the danielpetty-com namespace, project and Secret row #6642): destination danielpetty-com-pixelfed, and orphan ignore entries for Secrets pixelfed-app-key and pixelfed-valkey and ConfigMap cnpg-default-monitoring.
  • cluster_secrets.py: add danielpetty-com-pixelfed to DETACHED_STACKS. Rows in that stack:
    • danielpetty-com-pixelfed/pixelfed-app-key, key APP_KEY: keyring danielpetty_com_pixelfed_app_key, required, generator urlsafe with 24 bytes. change_note says that a new value makes the stored encrypted data unreadable. Restarts pixelfed-web, pixelfed-horizon and pixelfed-scheduler;
    • danielpetty-com-pixelfed/pixelfed-valkey, key password: required, generator hex with 32 bytes. Restarts pixelfed-valkey and the three Pixelfed Deployments.
  • k8s/monitoring/networkpolicy.yaml: egress to namespace danielpetty-com-pixelfed on TCP 9187 (CloudNativePG) and 9121 (redis_exporter).
  • k8s/README.md: the 2 rows in the Cluster Secrets table.
  • Change each test first.

Premise check: as in #6642 (#5134 plan step 12).

Acceptance criteria

  • uv run devops ci --check --only k8s,kube-linter,domain passes.
  • A unit test shows that the APP_KEY row makes a 32-character value when the keyring has no value.
  • uv run devops k8s push-secrets --stack danielpetty-com-pixelfed --dry-run lists APP_KEY and password and no value.
  • kubectl kustomize k8s | yq 'select(.kind == "Namespace" and .metadata.name == "danielpetty-com-pixelfed") | .metadata.labels' shows enforce baseline, and warn and audit restricted.
  • After the merge and the sync of Application base: kubectl get ns danielpetty-com-pixelfed -L pod-security.kubernetes.io/enforce shows baseline.

Person steps

  1. In the review of this pull request, approve the baseline level of namespace danielpetty-com-pixelfed. Only the owner can lower a security level (AGENTS.md rule 5).
  2. After the merge and the sync of base: uv run devops k8s push-secrets --stack danielpetty-com-pixelfed --plan, then the same command without --plan.
  3. Keep a copy of APP_KEY offline. A restore of the Pixelfed database needs it.

Dependencies

Alternatives check of 2026-11-21: none.
Tool: none found.
Reason: Searches found only small Pixelfed Helm charts (holysoles/pixelfed-chart, last push Jan 2025, fork image) and a test-cluster chart set; none supplies this repository's namespace, keyring-backed secret rows or Pod Security level.

Lacks:

  • Helm chart cannot replace the repository's kustomize manifests and Argo CD Application
  • No keyring-backed APP_KEY row that keeps one value forever
  • Fork image keeps the root entrypoint and port 80, so still no restricted Pod Security
  • No namespace Pod Security labels, orphan ignores or Alloy egress policy

Activity

  1. added
    type/feature
    scope/k8s
    source/agent
    status/new
    value/medium
    on Nov 21, 2026
  2. dan-petty commented on Nov 21, 2026

    @dan-petty
    OwnerAuthor
  3. added
    effort/medium
    priority/p2-medium
    on Nov 21, 2026
  4. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.

    Searches (10)

    Tools considered:

    Searches run:

    • Pixelfed Helm chart Kubernetes deployment, results: 5
    • Pixelfed docker image non-root user Pod Security restricted Kubernetes, results: 5
    • "pixelfed" kubernetes manifest deployment github, results: 5
    • jippi/docker-pixelfed run as root USER root, results: 5
    • Pixelfed, results: 5
    • pixelfed kubernetes, results: 5
    • pixelfed helm, results: 5
    • nasqueron/pixelfed docker image, results: 5
    • holysoles pixelfed chart values, results: 5
    • pixelfed rootless container image, results: 5

    Sources:

  5. dan-petty commented on Nov 21, 2026

    @dan-petty
    OwnerAuthor

    Closed as not planned. Namespace danielpetty-com-pixelfed with Pod Security baseline comes from the services entry of the site in dan-petty/homelab (dan-petty/homelab#85), and the owner approved baseline on 2026-11-21. APP_KEY and the Valkey password come from External Secrets Operator in the site repository: a Password generator and a PushSecret with updatePolicy: IfNotExists keep each value stable, at a remote key that starts with the namespace (#6675, dan-petty/infra#12, dan-petty/homelab#82, dan-petty/danielpetty.com#30 and #31). The offline copy of APP_KEY stays an owner step in dan-petty/danielpetty.com#31. The operator-made CloudNativePG Secret and the ESO Secrets have owner references, so they need no orphan ignore.

  6. removed
    status/new
    on Nov 21, 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/mediumpriority/p2-mediumscope/k8ssource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions