ShortIQ

ShortIQ

AI

50 AI Prompts for Docker, Kubernetes, and DevOps

Developer-tested AI prompts for Docker, Kubernetes, GitHub Actions, monitoring, and production infrastructure. Build containers, write manifests, and automate CI/CD pipelines faster with copy-paste prompts.

June 27, 2026ShortIQ Editorial Team

Why DevOps Engineers Benefit from AI Prompts

DevOps work involves a large surface area of tools, formats, and cloud-specific syntax — Dockerfiles, Kubernetes YAML, Helm charts, Terraform, GitHub Actions, and monitoring configs all have their own conventions. A small mistake in a Kubernetes manifest or a missing flag in a Dockerfile can cost an engineer hours of debugging. AI prompts reduce that surface area dramatically when given enough context about the target environment.

The most common failure mode with AI-generated DevOps code is too little context: the model does not know whether you are deploying to EKS, GKE, or bare metal Kubernetes; whether your app is Node.js or Go; or what resource limits are appropriate for your workload. The prompts in this guide solve that by building context directly into each prompt structure.

  • Generate production-ready Dockerfiles with multi-stage builds and security hardening
  • Write Kubernetes Deployment, Service, Ingress, and ConfigMap manifests in seconds
  • Build GitHub Actions workflows for CI/CD, testing, and container registry pushes
  • Set up Prometheus and Grafana monitoring configs for your services
  • Debug Kubernetes pod failures and resource constraint issues with AI assistance

Docker Container and Dockerfile Prompts

A production Dockerfile requires multi-stage builds to keep the final image small, a non-root user for security, a health check for container orchestration, and correct layer ordering to maximize cache hits. These prompts generate Dockerfiles that cover all of these requirements for common application types.

Always specify the base image, runtime version, entry point, and any environment variables in the prompt. Without this information the model generates a generic Dockerfile that may not match your application structure or security requirements.

text
Act as a Docker expert.

Task:
Write a production-ready Dockerfile for a Node.js TypeScript application.

Requirements:
- Multi-stage build: build stage compiles TypeScript, runtime stage runs the output
- Build stage: install all dependencies (devDependencies included), run tsc
- Runtime stage: copy dist/ and node_modules (production only), run as non-root user
- Base image: node:20-alpine for both stages
- Set NODE_ENV=production in runtime stage
- Expose port 3000
- Add HEALTHCHECK: curl -f http://localhost:3000/health every 30 seconds
- .dockerignore should exclude node_modules, .env, dist

App: Express.js API, entry point is dist/index.js after compilation

Docker Compose Multi-Service Prompts

Docker Compose is the standard tool for running multi-service local development environments. A well-structured Compose file defines service dependencies, shared networks, named volumes for data persistence, and environment variable injection from .env files.

These prompts generate Compose files for the most common stacks: Node.js with PostgreSQL and Redis, Next.js with a database and a background worker, and full-stack apps with a reverse proxy. Specify your services, ports, and environment variables for accurate output.

text
Act as a Docker Compose expert.

Task:
Write a docker-compose.yml for a full-stack application with these services:

Services:
1. api - Node.js Express app (build from ./api, port 3000)
2. web - Next.js frontend (build from ./web, port 3001)
3. postgres - PostgreSQL 16 with persistent volume, port 5432
4. redis - Redis 7 alpine with persistent volume, port 6379

Requirements:
- api depends_on postgres and redis (with health checks)
- web depends_on api
- Shared network: app-network
- Load environment variables from .env file for api service
- Named volumes for postgres data and redis data
- Restart policy: unless-stopped for all services

Kubernetes Deployment and Service Prompts

Kubernetes Deployment and Service manifests are the foundation of any K8s workload. A production Deployment needs resource requests and limits, liveness and readiness probes, a rolling update strategy, and environment variable injection from ConfigMaps and Secrets. These prompts generate complete manifests rather than minimal examples.

The key detail to include in every Kubernetes prompt is the resource profile of your application — CPU and memory usage at idle and under load. Without this the model generates generic requests and limits that may cause OOMKilled errors or throttling in production.

text
Act as a Kubernetes expert.

Task:
Write Kubernetes Deployment and Service manifests for a Node.js API.

Deployment requirements:
- 3 replicas, rolling update (maxSurge: 1, maxUnavailable: 0)
- Resource requests: 100m CPU, 128Mi memory
- Resource limits: 500m CPU, 512Mi memory
- Liveness probe: GET /health, initial delay 15s, period 30s
- Readiness probe: GET /ready, initial delay 5s, period 10s
- Env vars: DB_URL and REDIS_URL from Secret named api-secrets
- Env var: NODE_ENV=production (literal value)

Service requirements:
- Type: ClusterIP
- Port 80 targeting container port 3000

App name: node-api, namespace: production, image: myregistry/node-api:v1.0.0

GitHub Actions CI/CD Pipeline Prompts

GitHub Actions is the most widely used CI/CD platform for projects hosted on GitHub. A complete pipeline for a containerized application typically includes a test job, a build-and-push job that produces a Docker image, and a deploy job that updates the running service. These prompts generate full workflow files with proper job dependencies and secret injection.

Always specify the trigger events (push to main, pull_request), the registry (Docker Hub, GitHub Container Registry, ECR), and whether the deploy step uses SSH, kubectl, or a cloud CLI. The prompts below cover the most common patterns.

text
Act as a GitHub Actions expert.

Task:
Write a GitHub Actions workflow for a Node.js TypeScript application.

Trigger: push to main branch and pull_request to main

Jobs:
1. test: run on ubuntu-latest
   - Setup Node.js 20 with npm cache
   - npm ci
   - npm run lint
   - npm test

2. build-and-push: runs only on push to main, depends on test
   - Login to GitHub Container Registry (ghcr.io) using GITHUB_TOKEN
   - Build Docker image tagged with the git SHA and latest
   - Push both tags to ghcr.io

3. deploy: runs after build-and-push, push to main only
   - SSH into the VPS using SSH_PRIVATE_KEY secret
   - Pull the new image and restart the container via docker compose up -d

Secrets used: SSH_PRIVATE_KEY, VPS_HOST, VPS_USER

Kubernetes Debugging and Troubleshooting Prompts

Kubernetes debugging is one of the highest-value uses of AI in DevOps work. Pod failures, resource evictions, ImagePullBackOff errors, and CrashLoopBackOff cycles all produce specific error messages and kubectl output that AI can interpret with high accuracy when given the full context.

Paste the output of kubectl describe pod, kubectl logs, and kubectl get events into the prompt along with your manifest. The model can identify the root cause in seconds for the most common failure patterns.

text
Act as a Kubernetes debugging expert.

Task:
Diagnose why my pod is in CrashLoopBackOff and provide a fix.

Provide:
1. The most likely root causes for this error output
2. kubectl commands to gather more information
3. The specific fix for each likely cause
4. How to verify the fix worked

kubectl describe pod output:
[paste here]

kubectl logs output:
[paste here]

Deployment manifest:
[paste here]

Monitoring and Observability Prompts

Prometheus and Grafana are the standard monitoring stack for Kubernetes and containerized applications. These prompts generate Prometheus scrape configs, alerting rules, and Grafana dashboard JSON for common services and system metrics.

For application-level observability, prompts in this section also cover structured logging with Winston or Pino, distributed tracing with OpenTelemetry, and health check endpoint implementation for Kubernetes liveness and readiness probes.

text
Act as a Prometheus and Node.js observability expert.

Task:
Add Prometheus metrics to a Node.js Express application using prom-client.

Metrics to expose:
1. HTTP request duration histogram (labels: method, route, status_code)
2. HTTP requests total counter (labels: method, route, status_code)
3. Active connections gauge
4. Custom business metric: orders_created_total counter

Requirements:
- Expose metrics on GET /metrics endpoint
- Use Express middleware to instrument all routes automatically
- Register default Node.js process metrics (CPU, memory, GC)
- TypeScript types for all metric objects

Also provide the Prometheus scrape config for this service.

Security Hardening and Production Readiness Prompts

Production infrastructure requires security hardening at every layer — container image scanning, Kubernetes RBAC, network policies, secrets management, and least-privilege service accounts. These prompts generate the configurations needed to pass a security audit for containerized workloads.

The most commonly missed security items in Kubernetes are running containers as root, missing network policies that allow all pod-to-pod communication, and Secrets stored as base64-encoded literals in git. The prompts below address all three patterns.

text
Act as a Kubernetes security expert.

Task:
Audit this Kubernetes Deployment manifest and list all security issues with fixes.

Check for:
1. Containers running as root (missing securityContext)
2. Missing read-only root filesystem
3. Privileged containers
4. Missing resource limits (potential DoS)
5. Secrets passed as environment variables vs mounted as files
6. Container image using :latest tag
7. Missing pod disruption budget
8. Service account with default RBAC permissions

For each issue: explain the risk, show the insecure config, show the fixed config.

Manifest to audit:
[paste your manifest here]

FAQ

What is the best way to use AI for DevOps tasks?

Provide the full context: your cloud provider, container runtime, Kubernetes version, application language, and the specific requirements for the manifest or workflow. The more detail you include upfront, the less back-and-forth is needed to get a production-ready result.

Can AI generate a working Dockerfile for my application?

Yes. Specify the runtime (Node.js, Python, Go), the entry point, which ports to expose, and any security requirements such as non-root user. The prompts in Section 2 cover multi-stage builds for TypeScript applications. For other languages, replace the language and build commands in the same prompt structure.

Can AI write Kubernetes YAML manifests?

Yes, and Kubernetes is one of the best use cases for AI prompts because the YAML syntax is strict and the number of required fields is large. Provide the app name, image, namespace, resource profile, environment variables, and probe endpoints. AI generates complete manifests that need minimal editing.

How do I prompt AI for GitHub Actions workflows?

List the trigger events, each job with its steps and dependencies, the secrets used, and the target deployment method. The prompt in Section 5 shows the exact structure. GitHub Actions syntax changes frequently so also specify the actions/checkout and actions/setup-node versions you need.

Can AI help debug Kubernetes pod failures?

Yes. Paste the output of kubectl describe pod and kubectl logs into the prompt. AI identifies the root cause of CrashLoopBackOff, OOMKilled, ImagePullBackOff, and Pending status issues quickly when given the full error output. The prompt in Section 6 shows how to structure this.

What AI model is best for DevOps and infrastructure tasks?

Claude performs well on infrastructure tasks that require strict YAML and Dockerfile syntax. GPT-4 is strong for Terraform and AWS-specific configurations. For GitHub Actions specifically, both models benefit from being given the current actions/checkout and setup-node versions since both have training data cutoffs that may miss recent changes.

Can AI help with Docker security hardening?

Yes. Provide your existing Dockerfile and ask for a security audit. Common fixes include switching to a non-root user, using a read-only filesystem, removing development dependencies from the final image, and pinning the base image to a specific digest rather than a tag. The prompt in Section 8 covers the full security checklist.

How do I use AI to set up Prometheus monitoring?

Specify the metrics you want to track (request duration, error rate, custom business metrics), the library you are using (prom-client for Node.js, prometheus-client for Python), and the endpoint you want to expose. The prompt in Section 7 generates the full instrumentation code and Prometheus scrape config together.

Related free tools

If you want to turn this topic into action, use one of ShortIQ's free tools for campaign planning, UTM structure, or QR distribution.

Continue Reading

Explore more guides on link shortener SaaS strategy, Bitly alternatives, and white label link management.

Free newsletter

Get new guides in your inbox

We publish practical guides on dev tooling, prompt engineering, marketing workflows, and deployment. No fluff — straight to the point.

No spam. Unsubscribe any time.

Was this article helpful?

Tell us if this guide solved the problem or what was still missing. We use this to improve the blog and only follow up if you explicitly allow it.

We use this to improve tutorials, examples, and technical depth.