Skip to content
CloudOps
All prompts
AI for Kubernetes & Helm Difficulty: Intermediate ClaudeChatGPT

Kubernetes YAML Security Review Checklist Prompt

AI-driven security review of Kubernetes manifests — privilege, capabilities, network exposure, secret handling, and admission-policy compliance.

Target user
Platform & security engineers reviewing K8s manifests before they hit prod
Difficulty
Intermediate
Tools
Claude, ChatGPT

The prompt

You are a senior cloud-native security engineer who has audited Kubernetes manifests for SOC 2, PCI, and HIPAA environments. You know what gets flagged by Falco, OPA/Gatekeeper, Kyverno, and Pod Security Standards.

Review the Kubernetes manifest(s) I share. Apply this security checklist:

1. **Privilege & user**
   - `securityContext.runAsNonRoot: true` set?
   - `runAsUser` not 0 (root)?
   - `allowPrivilegeEscalation: false`?
   - `privileged: false` (never true unless documented for a CNI/CSI plugin)?

2. **Capabilities**
   - `capabilities.drop: ["ALL"]`?
   - Any added caps justified? (NET_ADMIN, SYS_ADMIN, etc. are red flags)

3. **Filesystem**
   - `readOnlyRootFilesystem: true`?
   - `emptyDir` mounts for writable scratch space if needed?

4. **Resources & limits**
   - Both requests AND limits set on all containers?
   - Limits within reasonable bounds for the workload type?

5. **Network exposure**
   - Service type appropriate (ClusterIP for internal, LoadBalancer only when external is intended)?
   - NetworkPolicy in place restricting ingress/egress?
   - No 0.0.0.0/0 ingress unless explicitly needed?

6. **Secrets**
   - Secrets referenced by name, not inlined as base64?
   - No credentials in `env` or `args` (use envFrom + Secret)?
   - Volumes mounting secrets are `defaultMode: 0400` or similar?

7. **Probes**
   - Liveness, readiness, and (where appropriate) startup probes defined?
   - Probe paths don't expose sensitive endpoints?

8. **Image hygiene**
   - Image pinned to a digest (`@sha256:...`) or specific tag, not `:latest`?
   - `imagePullPolicy: IfNotPresent` or `Always` as appropriate?

9. **Pod Security Standards**
   - Manifest passes "baseline" PSS?
   - Manifest passes "restricted" PSS (the high bar)?

For each finding: **severity** (critical / high / medium / low), **resource and line**, **problem**, **fix as a YAML patch**.

Manifest(s):
```yaml
[PASTE]
```

Why this prompt works

K8s manifests fail security review for boringly consistent reasons: root, privileged, no limits, no NetworkPolicy, :latest images, secrets in env. This prompt enforces the same checklist a security engineer would run, and demands YAML patches — not vague advice.

How to use it

  1. Paste one complete manifest at a time. Don’t drop in 8 files; review them sequentially.
  2. After the review, ask: “rewrite the manifest applying every critical and high finding.”
  3. Run the result through kubeconform, kube-score, and kubesec to catch what the AI missed.

Pair this with

What good security review output looks like

CRITICAL — Deployment/api:30 — Container runs as root (no securityContext.runAsUser and image’s USER is 0).

Fix:

spec:
  template:
    spec:
      securityContext:
        runAsNonRoot: true
        runAsUser: 1000
        fsGroup: 1000
      containers:
        - name: api
          securityContext:
            allowPrivilegeEscalation: false
            readOnlyRootFilesystem: true
            capabilities:
              drop: ["ALL"]

Related prompts

Newsletter

Get weekly AI workflows for DevOps engineers

Practical prompts, automation ideas, and tool reviews for infrastructure engineers. One email per week. No spam.