| name | kubernetes-deployer |
| description | Package and deploy applications to Kubernetes with Dockerfiles, Helm charts, and local Minikube deployment. Use when containerizing applications, creating Kubernetes manifests, setting up Helm charts, deploying to Minikube, or preparing cloud-ready configurations. Focuses on local-first deployment with stateless services. |
Kubernetes Deployer
Deploy applications to Kubernetes with production-ready configurations, starting locally with Minikube.
Deployment Workflow
1. Dockerfile → Containerize application
2. Helm Chart → Package Kubernetes manifests
3. Local Deploy → Test in Minikube
4. Cloud Ready → Configure for production
Quick Start: Local Deployment
1. Create Dockerfile
# Python example (see references for other languages)
FROM python:3.11-slim AS builder
WORKDIR /build
COPY pyproject.toml ./
RUN pip install --no-cache-dir .
FROM python:3.11-slim
WORKDIR /app
RUN useradd -m -u 1000 appuser
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
COPY app ./app
USER appuser
EXPOSE 8000
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
2. Copy Helm Chart Template
Copy assets/helm-template/ to charts/<app-name>/ and customize:
cp -r assets/helm-template charts/myapp
3. Deploy to Minikube
minikube start
eval $(minikube docker-env)
docker build -t myapp:local .
helm upgrade --install myapp ./charts/myapp \
--set image.repository=myapp \
--set image.tag=local \
--set image.pullPolicy=Never
kubectl port-forward svc/myapp 8080:80
Core Principles
- Local-first - Test everything in Minikube before cloud
- Stateless services - No local state; use external databases
- Config via env vars - All configuration through environment
- 12-factor ready - Portable between environments
Helm Chart Structure
charts/<app-name>/
├── Chart.yaml # Metadata
├── values.yaml # Default config
└── templates/
├── _helpers.tpl # Template functions
├── deployment.yaml
├── service.yaml
├── ingress.yaml # Optional
└── hpa.yaml # Optional
Configuration Patterns
Environment Variables
env:
- name: DATABASE_URL
value: "postgresql://..."
- name: LOG_LEVEL
value: "info"
envFrom:
- secretRef:
name: app-secrets
Create Secret
kubectl create secret generic app-secrets \
--from-literal=DATABASE_PASSWORD=secret123 \
--from-literal=API_KEY=key456
Health Checks
livenessProbe:
httpGet:
path: /health
port: http
initialDelaySeconds: 10
readinessProbe:
httpGet:
path: /health
port: http
initialDelaySeconds: 5
Common Commands
Minikube
minikube start
minikube dashboard
eval $(minikube docker-env)
minikube service myapp --url
Helm
helm lint ./charts/myapp
helm template myapp ./charts/myapp
helm upgrade --install myapp ./charts/myapp
helm uninstall myapp
Kubectl
kubectl get pods
kubectl logs <pod>
kubectl describe pod <pod>
kubectl port-forward svc/myapp 8080:80
Environment-Specific Values
replicaCount: 1
resources:
limits:
cpu: 200m
memory: 256Mi
replicaCount: 3
autoscaling:
enabled: true
minReplicas: 3
maxReplicas: 10
Deploy with environment:
helm upgrade --install myapp ./charts/myapp \
-f values.yaml \
-f values-prod.yaml
Troubleshooting
| Issue | Command |
|---|
| Pod not starting | kubectl describe pod <name> |
| Image not found | minikube ssh docker images |
| Service unreachable | kubectl get endpoints |
| Logs | kubectl logs <pod> -f |
References
Assets