---
name: kubernetes-deployment-validator
description: "Checks a Deployment manifest against the target cluster version and your policy on image tags and resource limits, and reports errors, warnings, and fixes with the exact field path for each. Use when a Deployment manifest must pass a check for a specific Kubernetes version and an image tag or resource limit policy before it is applied. Do not use for rewriting the manifest or explaining it to a non-expert reader. Related topics: coding, kubernetes."
---

# Kubernetes Deployment Validator

Checks a Deployment manifest against the target cluster version and your policy on image tags and resource limits, and reports errors, warnings, and fixes with the exact field path for each.

## When to use

Use this skill when a Deployment manifest must pass a check for a specific Kubernetes version and an image tag or resource limit policy before it is applied. Do not use it for rewriting the manifest or explaining it to a non-expert reader.

## Workflow

1. Ask the user for each input listed below in a single message, skipping any they have already given. Where options are listed, offer them, but accept other answers too.
2. Validate schema and required fields against the chosen Kubernetes version, so every field that would be rejected at apply time is listed as an error.
3. Confirm the selector matches the template labels and the namespace matches the one given.
4. Apply the image tag and resource limit policy toggles and classify each breach as an error or warning according to the strictness chosen.
5. Scan for operational risks that pass schema checks, such as missing probes or a root user, and record each with its YAML path.
6. Write the report in the selected format with Summary, Errors, Warnings, and Recommendations, and nothing outside those sections.

## Inputs

- **Deployment manifest** (longer free text)
- **Kubernetes version** (choose one: 1.26, 1.27, 1.28, 1.29)
- **Namespace** (free text, e.g. "default")
- **Enforce image tag policy** (choose one: Strict, Relaxed)
- **Require resource limits** (choose one: Yes, No)
- **Output format** (choose one: Markdown, JSON)

## Output

A report in Markdown or JSON with exactly four sections: Summary (counts), Errors, Warnings, Recommendations. Each finding names the YAML path, the problem, and the fix.

## Prompt template

Fill the inputs into this template and follow it as the full instruction.

### Kubernetes Deployment Validator

Validate my Deployment manifest before it reaches the cluster.

- Deployment manifest: {{Deployment manifest}}
- Kubernetes version: {{Kubernetes version}}
- Namespace: {{Namespace}}
- Enforce image tag policy: {{Enforce image tag policy}}
- Require resource limits: {{Require resource limits}}
- Output format: {{Output format}}

Check schema first: apiVersion and kind, required fields, field names and types, and any field removed or renamed in the chosen version. Then check that the selector matches the template labels, since a mismatch is rejected at apply time. Apply the policy toggles next: under Strict, any image without a pinned tag or digest is an error and latest is always an error; under Relaxed, a floating tag is a warning. When resource limits are required, every container without requests and limits is an error, otherwise a warning. Then look for the operational problems that pass schema validation but fail in production: no readiness probe, liveness and readiness on the same endpoint, a single replica with maxUnavailable 1, a namespace in the manifest that differs from the given one, containers running as root. Classify each finding as an Error (apply or rollout will fail or the policy is violated) or a Warning (it will run but is risky), and cite the YAML path of the field. Return only the report in the selected format with four sections: Summary, Errors, Warnings, Recommendations.

## Pitfalls

- Reporting a floating tag as an error under the Relaxed policy, which trains the team to ignore the validator.
- Missing a field that was removed in the target version because the manifest still parses as YAML.
- Padding the report with style remarks when it should contain only what blocks the apply or endangers the rollout.
