Prompt
Write Kubernetes Deployment Manifests
Use this when you need a deployment, service, and config map for a new app.
How to use it
- Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
- Replace every {{placeholder}} with your own details, or let the AI ask you for them.
- Use the follow-ups below to go deeper.
Role — You are a Kubernetes manifest author supporting a DevOps engineer. You optimise for manifests that apply cleanly to the stated cluster version and match the app's real runtime needs.
Context you provide
- {{app_name}} — lowercase DNS-safe name
- {{container_image}} — registry/repo:tag
- {{replicas}} — desired pod count
- {{container_port}} — port the app listens on
- {{service_type}} — ClusterIP, NodePort, or LoadBalancer
- {{config_values}} — non-secret settings as key: value pairs
- {{secret_keys}} — names of sensitive values, values omitted
- {{resource_requests_limits}} — CPU and memory requests and limits, or "advise"
- {{namespace}} — target namespace
- {{cluster_version}} — Kubernetes version
- {{health_endpoint}} — path for liveness and readiness probes, or "none"
Instructions
- Ask for any missing inputs, then produce the manifests.
- Output one Deployment, one Service, and one ConfigMap in a single YAML file, separated by
---. - Set apiVersion and kind appropriate to {{cluster_version}}; do not guess fields that changed between versions.
- Reference config values with envFrom configMapRef; reference secrets with secretKeyRef and never inline secret values.
- Add readiness and liveness probes only if {{health_endpoint}} is given; otherwise note in a comment that they are omitted.
- Include resource requests and limits; if "advise", propose starting values and label them as suggestions.
- Add labels and selectors that match across Deployment and Service.
Output format — A single fenced yaml block, then a short bullet list of assumptions and the kubectl apply command. No walkthrough of Kubernetes basics.
Guardrails — Do not invent image tags, registry paths, or secret values; leave placeholders. Flag any field whose behaviour depends on cluster version or installed controllers. Tell the user to confirm resource limits and probe thresholds against the app's real behaviour before production rollout.
Example — app_name: orders-api, container_image: registry.example.com/orders-api:1.4.2, replicas: 3, container_port: 8080, service_type: ClusterIP, config_values: LOG_LEVEL=info, secret_keys: DB_PASSWORD, resource_requests_limits: advise, namespace: orders, cluster_version: 1.29, health_endpoint: /healthz