---
name: kubernetes-manifest-writer
description: "Valid Kubernetes YAML for a Deployment, Service, and optional Ingress, with probes, resource limits, and labels that line up so kubectl apply works first time. Use when a developer needs Kubernetes YAML for a containerised web app and wants a Deployment, Service, or Ingress that applies cleanly. Do not use for Helm charts, cluster setup, or Dockerfiles. Related topics: devops, cloud, coding."
---

# Kubernetes Manifest Writer

Valid Kubernetes YAML for a Deployment, Service, and optional Ingress, with probes, resource limits, and labels that line up so kubectl apply works first time.

## When to use

Use this skill when a developer needs Kubernetes YAML for a containerised web app and wants a Deployment, Service, or Ingress that applies cleanly. Do not use it for Helm charts, cluster setup, or Dockerfiles.

## 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. Define one label set and use it identically in the Deployment selector, pod template, and Service selector.
3. Write each requested resource with stable apiVersions and the chosen replicas and service type.
4. Add readiness and liveness probes and resource requests and limits if chosen, done when every container has probes.
5. Reference secrets as placeholders only.
6. List the apply and verify commands, including rollout status and port-forward.

## Inputs

- **App name** (free text, e.g. "my-web-app")
- **Container image** (free text, e.g. "nginx:1.27")
- **Container port** (number from 1 to 65535)
- **Resources to generate** (choose any: Deployment, Service, Ingress, ConfigMap, Secret)
- **Replicas** (number from 1 to 100)
- **Service type** (choose one: ClusterIP, NodePort, LoadBalancer)
- **CPU and memory limits** (choose one: Yes, No)

## Output

A single multi-document YAML file separated by dashes, followed by the kubectl commands to apply and verify it.

## Prompt template

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

### Kubernetes Manifests

Write Kubernetes manifests for the app below.

- App name: {{App name}}
- Container image: {{Container image}}
- Container port: {{Container port}}
- Resources to generate: {{Resources to generate}}
- Replicas: {{Replicas}}
- Service type: {{Service type}}
- CPU and memory limits: {{CPU and memory limits}}

Output one multi-document YAML file separated by three dashes, ready for kubectl apply. Use the same label set in the Deployment selector, pod template, and Service selector, because a mismatch is the most common reason a Service has no endpoints. Add readiness and liveness probes, a rolling update strategy, and requests and limits if chosen. Reference Secret keys as placeholders and never write real values. Use stable apiVersions. Finish with the apply, rollout status, and port-forward commands to verify.

## Pitfalls

- Mismatched selector and pod labels, which leave the Service with no endpoints.
- Limits set below what the app needs at start-up, causing restarts.
- Real secret values committed in a Secret manifest instead of placeholders.
