Generate Kubernetes deployment manifests
✓Works with OpenClaudeYou are a Kubernetes deployment specialist. The user wants to generate production-ready Kubernetes deployment manifests with proper resource management, health checks, and scaling configuration.
What to check first
- Run
kubectl version --clientto confirm kubectl CLI is installed and accessible - Verify the target Kubernetes cluster version matches your manifest API versions (v1 for Deployment, v1 for Service)
- Check if you have a container image already built and pushed to a registry (Docker Hub, ECR, GCR, etc.)
Steps
- Define the Deployment metadata with namespace, labels, and selector matching pod template labels
- Set replicas count and specify the Kubernetes API version
apiVersion: apps/v1 - Configure the container spec with image, image pull policy, and exposed ports
- Add resource requests (CPU/memory minimum) and limits (maximum) in the containers spec
- Implement liveness and readiness probes with appropriate httpGet, tcpSocket, or exec handlers
- Set environment variables or ConfigMap/Secret references for configuration
- Configure affinity rules, tolerations, or node selectors if targeting specific nodes
- Add a Service manifest to expose the Deployment internally or externally (ClusterIP, NodePort, LoadBalancer)
Code
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp-deployment
namespace: default
labels:
app: myapp
version: v1
spec:
replicas: 3
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
selector:
matchLabels:
app: myapp
template:
metadata:
labels:
app: myapp
version: v1
spec:
containers:
- name: myapp
image: myregistry/myapp:1.0.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
name: http
protocol: TCP
env:
- name: ENVIRONMENT
value: "production"
- name: LOG_LEVEL
valueFrom:
configMapKeyRef:
name: app-config
key: log_level
resources:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"
livenessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /ready
port: 8080
initialDelaySeconds: 10
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 2
Note: this example was truncated in the source. See the GitHub repo for the latest full version.
Common Pitfalls
- Treating this skill as a one-shot solution — most workflows need iteration and verification
- Skipping the verification steps — you don't know it worked until you measure
- Applying this skill without understanding the underlying problem — read the related docs first
When NOT to Use This Skill
- When a simpler manual approach would take less than 10 minutes
- On critical production systems without testing in staging first
- When you don't have permission or authorization to make these changes
How to Verify It Worked
- Run the verification steps documented above
- Compare the output against your expected baseline
- Check logs for any warnings or errors — silent failures are the worst kind
Production Considerations
- Test in staging before deploying to production
- Have a rollback plan — every change should be reversible
- Monitor the affected systems for at least 24 hours after the change
Related Docker & Kubernetes Skills
Other Claude Code skills in the same category — free to download.
Dockerfile Generator
Generate optimized Dockerfile for any project
Docker Compose
Create docker-compose.yml for multi-service apps
K8s Service
Create Kubernetes service and ingress configs
Helm Chart
Create Helm chart for application
Docker Multistage
Optimize Docker builds with multi-stage builds
K8s ConfigMap
Create ConfigMaps and Secrets management
Docker Security
Audit and fix Dockerfile security issues
K8s HPA
Set up Horizontal Pod Autoscaler
Want a Docker & Kubernetes skill personalized to YOUR project?
This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.