---
name: k8s-podspec-pro
description: Writes and reviews Kubernetes pod specs against Bret Fisher's production floor (github.com/BretFisher/podspec) for security context, user namespaces, service account tokens, probes, resources, and graceful shutdown. Use it when the user creates or edits a Deployment, StatefulSet, DaemonSet, Job, CronJob, or Pod, changes a Helm chart or Kustomize base that renders one, asks to review or harden a workload for production, or asks why a pod spec setting matters, even if they only say "deploy this to Kubernetes".
license: MIT
compatibility: scripts/floor-check.py needs Python 3 and yq.
title: k8s-podspec-pro
canonical_url: https://skilld.dev/gh/bretfisher/skills/k8s-podspec-pro
last_updated: 2026-11-12T02:21:18.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [agents/openai.yaml](https://skilld.dev/api/skills-raw/bretfisher/skills/k8s-podspec-pro/agents/openai.yaml), [references/pod.yaml](https://skilld.dev/api/skills-raw/bretfisher/skills/k8s-podspec-pro/references/pod.yaml), [references/why.md](https://skilld.dev/api/skills-raw/bretfisher/skills/k8s-podspec-pro/references/why.md), [references/workload-kinds.md](https://skilld.dev/api/skills-raw/bretfisher/skills/k8s-podspec-pro/references/workload-kinds.md), [scripts/floor-check.py](https://skilld.dev/api/skills-raw/bretfisher/skills/k8s-podspec-pro/scripts/floor-check.py).
>
> If the user asked to install this Skill, run `npx skilld install bretfisher/skills/k8s-podspec-pro`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/k8s-podspec-pro`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/bretfisher/skills/k8s-podspec-pro) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/k8s-podspec-pro`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/k8s-podspec-pro --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/k8s-podspec-pro --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Kubernetes pod spec floor

Every pod template you write or review meets the **floor**: the settings in [pod.yaml](https://skilld.dev/api/skills-raw/bretfisher/skills/k8s-podspec-pro/references/pod.yaml),
an exact copy of <https://github.com/BretFisher/podspec/blob/main/pod.yaml>. Read pod.yaml at the start of
each task. Its field layout and its inline comments are the shape you copy, and the table below is the
summary with the exceptions.

## Working style

1. Find the pod template. Deployment, StatefulSet, DaemonSet, ReplicaSet, and Job: `spec.template.spec`.
   CronJob: `spec.jobTemplate.spec.template.spec`. Pod: `spec`. A Job, CronJob, DaemonSet, StatefulSet,
   Helm chart, or Kustomize base → read [workload-kinds.md](https://skilld.dev/api/skills-raw/bretfisher/skills/k8s-podspec-pro/references/workload-kinds.md) first.
2. Facts are yours to find: the Dockerfile `USER` and `EXPOSE`, the health endpoints in the code, the
   conventions of the repo's other manifests. Read them before you write a value.
3. Values only the user knows are decisions: memory and CPU numbers, a UID when the image has no numeric
   `USER`, a probe path the code does not show, a livenessProbe, a grace period other than 600. Ask for
   them in one bundled question. When the user is unavailable or says to go ahead, write the pod.yaml
   value with a `# TODO:` comment and list it under `## Placeholders`.
4. An edit brings every pod template you touch up to the floor, because the user asked you into that
   file; other files keep their content.

## The floor

| Field                                | Value                                                                                                    | Why, and the exception                                                                                                                                                                                                                                                                                                                                                   |
| ------------------------------------ | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `image`                              | an immutable tag (semver, git SHA, build ID) or a digest                                                 | A moving tag (`latest`, `stable`, none) runs different code in two pods and breaks rollback. Keep the user's tag and add `# TODO: pin to an immutable tag`. Leave `imagePullPolicy` out: its defaults are correct.                                                                                                                                                       |
| `ports[].containerPort`              | the app's port, written in the spec                                                                      | Many images have no `EXPOSE`. A batch container with no server gets no port.                                                                                                                                                                                                                                                                                             |
| `readinessProbe`                     | on every long-running container; `exec` when there is no port                                            | A rolling update and a Service wait for it. Jobs and CronJobs have neither, so they get no readinessProbe.                                                                                                                                                                                                                                                               |
| `livenessProbe`                      | only for an app known to hang                                                                            | A bad one restarts healthy pods. It never checks a dependency, because then a database outage restarts every pod.                                                                                                                                                                                                                                                        |
| `resources`                          | `requests.memory` = `limits.memory`, `requests.cpu` set, no `limits.cpu`                                 | Memory cannot be throttled, so the limit equals what the scheduler reserves. A CPU limit throttles on an idle node. This gives **Burstable** QoS; **Guaranteed** needs CPU and memory limits equal to requests on every container, so add `limits.cpu` = `requests.cpu` only when the user needs Guaranteed (static CPU manager). The pod.yaml numbers are placeholders. |
| container `securityContext`          | `allowPrivilegeEscalation: false`, `privileged: false`                                                   | Blocks setuid gain; a privileged container is host root.                                                                                                                                                                                                                                                                                                                 |
| pod `securityContext.seccompProfile` | `type: RuntimeDefault`                                                                                   | Kubernetes runs `Unconfined` unless asked.                                                                                                                                                                                                                                                                                                                               |
| pod `securityContext` user           | `runAsNonRoot: true`; `runAsUser` and `runAsGroup: 1001` unless the image sets a numeric non-root `USER` | A named `USER` (`USER node`) with `runAsNonRoot` fails with `CreateContainerConfigError`; set `runAsUser` or tell the user to make `USER` numeric. Keep UIDs below 65536.                                                                                                                                                                                                |
| `hostUsers`                          | `false`                                                                                                  | Container root maps to an unused host UID. GA in 1.36, on by default since 1.33. A pod with `hostNetwork`, `hostPID`, or `hostIPC` keeps the host user namespace: leave `hostUsers` out and say why. Name the node requirements in the hand-back.                                                                                                                        |
| `automountServiceAccountToken`       | `false`                                                                                                  | Most apps never call the API. An app that does (operator, controller, CI runner) gets `true`, its own `serviceAccountName`, and minimal RBAC.                                                                                                                                                                                                                            |
| `enableServiceLinks`                 | `false`                                                                                                  | Service env vars clash with the app's own. Tell the user to search the app for `_SERVICE_HOST`, `_SERVICE_PORT`, and `_PORT_` and use DNS names.                                                                                                                                                                                                                         |
| `terminationGracePeriodSeconds`      | `600`                                                                                                    | The 30s default cuts long polls, uploads, and queue drains. It is a maximum: an app that exits early does not wait.                                                                                                                                                                                                                                                      |
| `appArmorProfile`                    | unset, as the commented block in pod.yaml                                                                | Setting it stops pods on SELinux nodes. Uncomment it only when every node runs AppArmor; `Unconfined` is a finding.                                                                                                                                                                                                                                                      |

The node requirements, the token alternatives, and the full reasons are in [why.md](https://skilld.dev/api/skills-raw/bretfisher/skills/k8s-podspec-pro/references/why.md):
read it when the user asks why, or when an exception in the table applies.

## Teaching comments

A manifest you write keeps the pod.yaml style: one short inline `#` comment on each floor field that says
why it is there. The comments are how the user's team learns the floor, so they stay in the output.

## Review

When the user asks you to review, audit, or check a manifest for production, run `scripts/floor-check.py`
on it (or on `helm template` / `kustomize build` output piped to `-`) and write the report under these
three `##` headings, in this order:

- `## Meets the floor`: the floor fields already set.
- `## Missing or wrong`: one entry per finding with the field, its location, the fixed YAML, and one
  sentence on why. Cite the script's rule id. Add what the script cannot see: a probe that checks a
  dependency, numbers that look copied from pod.yaml.
- `## Suggested`: `readOnlyRootFilesystem: true`, `capabilities.drop: [ALL]`, a `startupProbe` for a slow
  boot, a PodDisruptionBudget, a NetworkPolicy. One line each.

Change the manifest only when the user asks for fixes, because a review is a report.

## Hand-back

End every create or edit task with these three `##` sections, in this order:

- `## Defaults applied`: a `| Default | Why here |` table, one row per floor field you set.
- `## Questions`: the decisions from working style step 3 that are still open, numbered. Write `none`
  when there are none.
- `## Placeholders`: every `# TODO:` value with its field. Write `none` when there are none.

## Validate

Run `scripts/floor-check.py <file>...` on every manifest you wrote or edited. It prints one line per
finding with a rule id and ends with `floor-check: clean` or the finding count. Fix each finding, or
keep it and say why in the hand-back (a CPU limit for Guaranteed QoS, a token for an operator). When
`kubeconform` is installed, also run `kubeconform -strict -summary <file>` for schema errors. A tool that
is absent: say so by name and offer the `brew install` command.

For fields newer than your training data, the `k8s-catch-up` skill has one file per feature.

## Done when

- [ ] `floor-check.py` is clean on every manifest you wrote or edited, or each remaining rule id is
      named in the hand-back with its reason
- [ ] Every floor field in the output has its teaching comment
- [ ] A review has the three headings and changes no file the user did not ask to change
- [ ] A create or edit ends with `## Defaults applied`, `## Questions`, and `## Placeholders`
