/polymath-kubernetes:propose-pod-security-standardsfrom polymath-kubernetes
Propose Kubernetes Pod Security Standards (privileged/baseline/restricted) per namespace; identify violating workloads and remediations.
Ships in polymath-kubernetes. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Roll out PSS at the namespace level. Output is the labels to apply + the workloads that need fixes first.
Mode: analytical — judgment inside a fixed frame. Keep the output shape; every verdict cites its evidence; unknowns are marked [TBD] or [VERIFY], never filled in.
baseline to restricted.kubectl get pods -o yaml, or the manifests in the repo).kubectl label commands; the operator applies them, warn/audit mode before enforce.hostNetwork, hostPID, privileged containers, hostPath (mostly), and similar.runAsNonRoot: true, allowPrivilegeEscalation: false, capabilities.drop: [ALL] (only NET_BIND_SERVICE may be added back), seccompProfile RuntimeDefault/Localhost, and restricted volume types. (readOnlyRootFilesystem is a good hardening default but not part of the restricted profile — don't report it as a PSS violation.)Per namespace, decide target level:
restricted.baseline if and only if the operator workloads are isolated; otherwise lift them to their own privileged namespace.kube-system and node-agent namespaces → privileged (no choice).Apply labels on the Namespace:
metadata:
labels:
pod-security.kubernetes.io/enforce: restricted
pod-security.kubernetes.io/enforce-version: v1.30 # pin; `latest` changes behavior on cluster upgrade
pod-security.kubernetes.io/audit: restricted
pod-security.kubernetes.io/warn: restricted
Use audit + warn first to get a report before flipping enforce.
Find violators — ask the API server, don't eyeball specs: a server-side dry run of the label lists every existing pod that would violate the level, without changing anything:
kubectl label --dry-run=server --overwrite ns payments \
pod-security.kubernetes.io/enforce=restricted
The common gaps moving from baseline → restricted:
runAsNonRoot: true not set.capabilities.drop: [ALL] not set.seccompProfile.type: RuntimeDefault not set.allowPrivilegeEscalation: false not set.Remediate — patch each workload's securityContext. For workloads that genuinely need a capability (e.g. NET_BIND_SERVICE to bind <1024), document the exception in an ADR and grant only that capability.
Verify — re-run the server-side dry run from step 3: it must report no warnings before you flip enforce. After the flip, roll one Deployment (kubectl rollout restart) and confirm its pods are admitted.
PSS rollout: payments namespace
Target: restricted
Audit pass — violators:
- refund (Deployment)
missing: runAsNonRoot, capabilities.drop:[ALL]
Fix: add securityContext block (see write-manifest skill; it also sets
readOnlyRootFilesystem as hardening beyond PSS).
- billing-job (CronJob)
missing: seccompProfile RuntimeDefault, allowPrivilegeEscalation: false
Fix: add the two fields to the job template's container.
- legacy-cron (CronJob)
requires CAP_NET_RAW (ping-based health checks).
Remediation: convert to a different health-check mechanism; or
ADR + move to a baseline namespace.
Step 1 — label namespace audit+warn=restricted. 1 week observation.
Step 2 — fix refund + billing-job; ADR for legacy-cron.
Step 3 — flip enforce=restricted.
enforce without an audit/warn shakedown.privileged: true "temporarily" to unblock a deploy.restricted and privileged workloads in the same namespace.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub mohammadbafkar/polymath --plugin polymath-kubernetes3 skills in this plugin
/audit-rbac-grantsAudit RBAC roles and bindings — find overbroad verbs (*), cluster-wide grants that should be namespaced, stale ServiceAccounts, anonymous access./write-manifestWrite a Kubernetes Deployment + Service + PDB manifest with safe defaults — resource requests/limits, probes, security context, topology spread.