Skip to main content

Claude/ChatGPT Prompt to Deploy a Stateless Service on Kubernetes

Production-grade Kubernetes manifests for a stateless service: probes, HPA, PDB, NetworkPolicy, RBAC, and kustomize overlays per environment.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt

                                

What this prompt does

This prompt frames the AI as a senior platform engineer that produces production-grade Kubernetes manifests as working YAML that applies cleanly with kubectl and kustomize, not pseudocode. You supply the [service_name], the container [image], the [environments] to overlay, and the [traffic_profile]. It returns a Deployment with resource requests and limits, liveness and readiness probes, and graceful shutdown; a ClusterIP Service plus Ingress with TLS; an HPA driven by CPU and one custom metric sized for the traffic profile; a PodDisruptionBudget and a NetworkPolicy; a ServiceAccount with least-privilege RBAC; and a kustomize base with overlays for each environment.

The structure works because it includes the parts copy-paste manifests usually skip: disruption budgets, network policy, and real probes, which are what keep a service alive through node drains and rolling updates instead of dropping traffic. [image] and [service_name] populate the Deployment and naming so the manifests reference what you actually run. [traffic_profile] sizes the HPA, so a bursty high-rps workload gets different scaling thresholds than a steady one. [environments] drives the overlays, parameterising replicas, limits, and host per environment so dev, staging, and prod diverge cleanly from a single shared base rather than living as three drifting copies.

When to use it

  • You need manifests that survive node drains and rolling updates, not toy examples.
  • You want PodDisruptionBudget and NetworkPolicy included by default.
  • You need per-environment overlays for replicas, limits, and host.
  • You want an HPA sized to your actual traffic shape.
  • You need least-privilege RBAC instead of a default service account.
  • You are deploying a stateless service and want a solid manifest baseline.

Example output

You get a kustomize directory tree with the base manifests (a Deployment with resource requests and limits, liveness and readiness probes, and graceful shutdown, a ClusterIP Service, an Ingress with TLS, an HPA, a PodDisruptionBudget, a NetworkPolicy, and a least-privilege ServiceAccount and RBAC) plus one example overlay parameterising replicas, limits, and host. The YAML is meant to apply cleanly with kubectl and kustomize, so it is structured as real files you can lay down and build on rather than conceptual snippets.

Pro tips

  • Set [traffic_profile] realistically; it sizes the HPA thresholds and behaviour.
  • List your real [environments] so the overlays parameterise the right values per stage.
  • Use the exact [image] reference so the Deployment pulls what you intend.
  • Tune the liveness probe carefully; too-aggressive checks restart healthy pods under load.
  • Keep the PodDisruptionBudget and NetworkPolicy; they are what blog-copied manifests omit and what keeps the service serving during node drains.
  • Review the RBAC to confirm the ServiceAccount grants only the permissions the service actually needs, not a broad default role.
  • Run kustomize build and a dry-run apply per overlay before trusting it against a real cluster.

Frequently Asked Questions

Does it include a PodDisruptionBudget and NetworkPolicy?
Yes, both are required deliverables, which is a key reason to use this over copied-from-a-blog manifests. The PDB protects availability during node drains and the NetworkPolicy restricts ingress and egress to what is needed. Review the NetworkPolicy against your dependencies before applying it.
Will the manifests apply cleanly with kustomize?
They are designed to apply cleanly with kubectl and kustomize, returning a base plus overlays rather than pseudocode. You should still run kustomize build and a dry-run apply against your cluster, since cluster-specific details like ingress class and storage may need small adjustments.
How does it size the autoscaler?
The HPA is driven by CPU and one custom metric, sized using the `[traffic_profile]` you provide. A bursty, high-rps profile produces different thresholds than a steady one, so describe your real traffic shape accurately to get scaling behaviour that matches how the service is actually hit.
Why does the prompt warn about liveness probes?
A too-aggressive liveness probe restarts healthy pods under load, which looks like an outage even though the service is fine. The manifests include real probes, but you should tune the liveness thresholds for your app's startup and response characteristics so it does not kill pods that are merely busy.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

More in Docker & Kubernetes Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support