Kubernetes Deployment
Overview
Kubernetes provides container orchestration for automated deployment, scaling, and management. This skill should be invoked when deploying containerized applications, managing microservices, or implementing auto-scaling.
Core Principles
- Declarative: Define desired state in manifests
- Self-Healing: Kubernetes maintains desired state
- Scaling: Horizontal pod autoscaling
- Service Networking: Services enable pod communication
Preparation Checklist
- Containerize application with Dockerfile
- Push image to registry
- Design Kubernetes manifests
- Plan resource requirements
Step-by-Step Process
- Containerize: Build Docker image
- Push: Push to container registry
- Manifest: Write Deployment, Service, ConfigMap
- Apply: Use kubectl apply -f
- Configure: Set up Ingress for external access
- Scale: Configure HPA for autoscaling
Do's and Don'ts
- ✅ Do use ConfigMaps for configuration
- ✅ Do set resource requests and limits
- ✅ Do implement health checks
- ❌ Don't hardcode secrets in manifests
- ❌ Don't skip namespace isolation
- ❌ Don't ignore resource limits
Anti-Patterns
- No Limits: Not setting CPU/memory limits
- Secrets in Code: Hardcoding secrets
- No Health Checks: Missing liveness/readiness probes
- Single Pod: No replicas for production