K8s Manifest Command
Generate production-ready Kubernetes manifests with best practices built in. Creates Deployments, Services, Ingress, HPA, PDB, NetworkPolicies, and ConfigMaps/Secrets with proper resource limits, health checks, and security contexts.
Command
/k8s-manifest
Description
Generates comprehensive Kubernetes manifests for deploying your application. Analyzes your project structure, Dockerfile, and environment configuration to produce production-ready YAML with security best practices, resource management, and observability.
Behavior
- Detect application type (web server, worker, cron job, etc.)
- Analyze resource requirements from Dockerfile and code
- Generate all required Kubernetes resources
- Validate manifests against best practices
- Output organized, well-commented YAML files
Generated Resources
Core Resources
# deployment.yaml apiVersion: apps/v1 kind: Deployment metadata: name: my-app labels: app.kubernetes.io/name: my-app app.kubernetes.io/version: "1.0.0" spec: replicas: 3 strategy: type: RollingUpdate rollingUpdate: maxSurge: 1 maxUnavailable: 0 selector: matchLabels: app.kubernetes.io/name: my-app template: spec: serviceAccountName: my-app securityContext: runAsNonRoot: true runAsUser: 1000 fsGroup: 1000 containers: - name: my-app image: registry.example.com/my-app:1.0.0 ports: - containerPort: 3000 protocol: TCP resources: requests: cpu: 100m memory: 128Mi limits: cpu: 500m memory: 512Mi livenessProbe: httpGet: path: /health port: 3000 initialDelaySeconds: 10 periodSeconds: 30 readinessProbe: httpGet: path: /ready port: 3000 initialDelaySeconds: 5 periodSeconds: 10 envFrom: - configMapRef: name: my-app-config - secretRef: name: my-app-secrets
Additional Resources Generated
| Resource | Purpose |
|---|---|
service.yaml | ClusterIP service for internal routing |
ingress.yaml | External access with TLS termination |
hpa.yaml | Horizontal Pod Autoscaler (CPU/memory) |
pdb.yaml | Pod Disruption Budget for availability |
networkpolicy.yaml | Network segmentation rules |
serviceaccount.yaml | Least-privilege service account |
configmap.yaml | Non-sensitive configuration |
secret.yaml | Template for sensitive values |
kustomization.yaml | Kustomize base for environment overlays |
Best Practices Applied
- Resource requests and limits on every container
- Liveness and readiness probes configured
- Security context: non-root, read-only filesystem, no privilege escalation
- Pod Disruption Budget to maintain availability during rollouts
- Network policies to restrict traffic
- Kubernetes-standard labels for identification
- Anti-affinity rules for spreading pods across nodes
Examples
# Generate manifests for current project /k8s-manifest # Specify namespace and registry /k8s-manifest --namespace production --registry gcr.io/my-project # Generate with Helm chart structure /k8s-manifest --format helm # Generate for specific workload type /k8s-manifest --type cronjob --schedule "0 */6 * * *"
Reviews
No reviews yet. Be the first to review this template!
Similar Templates
Git Commit Message Generator
Generates well-structured conventional commit messages by analyzing staged changes. Follows Conventional Commits spec with scope detection.
React Component Scaffolder
Scaffolds a complete React component with TypeScript types, Tailwind styles, Storybook stories, and unit tests. Follows project conventions automatically.
CI/CD Pipeline Generator
Generates GitHub Actions workflows for CI/CD including linting, testing, building, and deploying. Detects project stack automatically.