Skip to main content
coding advanced

Generate Kubernetes Deployment Manifest

Generate production-ready Kubernetes deployment manifests with best practices, resource limits, health checks, and security configurations.

Works with: chatgptclaudegemini

Prompt Template

You are a Senior DevOps Engineer specializing in Kubernetes. Create a comprehensive, production-ready Kubernetes deployment manifest for the following application: Application Details: - Application Name: [APPLICATION_NAME] - Container Image: [CONTAINER_IMAGE] - Port: [APPLICATION_PORT] - Environment: [ENVIRONMENT] - Namespace: [NAMESPACE] - Replicas: [REPLICA_COUNT] - Resource Requirements: [RESOURCE_REQUIREMENTS] Requirements: 1. Include proper metadata with labels and annotations following Kubernetes best practices 2. Configure resource requests and limits based on the specified requirements 3. Add comprehensive liveness and readiness probes appropriate for the application type 4. Implement rolling update strategy with appropriate maxSurge and maxUnavailable values 5. Include security context with non-root user and read-only filesystem where applicable 6. Add node affinity/anti-affinity rules for high availability 7. Configure environment variables and secrets mounting if needed 8. Include proper service account configuration 9. Add monitoring and observability labels 10. Follow semantic versioning for image tags Format the output as a complete YAML manifest with clear comments explaining each section. Include best practices for production deployment including security hardening, resource optimization, and operational excellence. Also provide a brief explanation of key configuration choices and any additional manifests (like Service or Ingress) that might be needed to complete the deployment.

Variables to Customize

[APPLICATION_NAME]

The name of your application

Example: web-api

[CONTAINER_IMAGE]

The Docker image to deploy

Example: myregistry/web-api:v1.2.3

[APPLICATION_PORT]

The port your application listens on

Example: 8080

[ENVIRONMENT]

Target environment (dev, staging, prod)

Example: production

[NAMESPACE]

Kubernetes namespace for deployment

Example: web-apps

[REPLICA_COUNT]

Number of pod replicas

Example: 3

[RESOURCE_REQUIREMENTS]

CPU and memory requirements

Example: CPU: 500m-1000m, Memory: 512Mi-1Gi

Example Output

```yaml apiVersion: apps/v1 kind: Deployment metadata: name: web-api namespace: web-apps labels: app: web-api version: v1.2.3 environment: production annotations: deployment.kubernetes.io/revision: "1" spec: replicas: 3 strategy: type: RollingUpdate rollingUpdate: maxSurge: 1 maxUnavailable: 0 selector: matchLabels: app: web-api template: metadata: labels: app: web-api version: v1.2.3 spec: serviceAccountName: web-api-sa securityContext: runAsNonRoot: true runAsUser: 1000 fsGroup: 2000 containers: - name: web-api image: myregistry/web-api:v1.2.3 ports: - containerPort: 8080 protocol: TCP resources: requests: cpu: 500m memory: 512Mi limits: cpu: 1000m memory: 1Gi livenessProbe: httpGet: path: /health port: 8080 initialDelaySeconds: 30 periodSeconds: 10 readinessProbe: httpGet: path: /ready port: 8080 initialDelaySeconds: 5 periodSeconds: 5 ``` **Key Configuration Choices:** - Rolling update with zero downtime (maxUnavailable: 0) - Security hardening with non-root user - Resource limits prevent resource exhaustion - Health checks ensure traffic routing to healthy pods

Pro Tips for Best Results

  • Always specify resource requests and limits to prevent resource starvation and enable proper scheduling
  • Use specific image tags instead of 'latest' for predictable deployments and easy rollbacks
  • Configure both liveness and readiness probes with appropriate endpoints for your application type
  • Include security context with non-root user and read-only filesystem when possible for enhanced security
  • Add meaningful labels and annotations for better organization and monitoring integration

Tags

Want 500+ Expert Prompts?

Get the Premium Prompt Pack — organized, tested, and ready to use.

Get it for $29

Related Prompts You Might Like