Kubernetes
Deploy moclojer to Kubernetes - Deployments, Services, ConfigMaps, and best practices for production-ready K8s deployments with health checks and scaling.
Deploy moclojer to Kubernetes for production-grade mock APIs with scaling and high availability.
π What You'll Build
β Kubernetes Deployment
β Service (ClusterIP/LoadBalancer)
β ConfigMap for configuration
β Health checks (liveness/readiness)
β Resource limits
β Horizontal Pod Autoscaling
π Quick Start
1. ConfigMap for Configuration
# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: moclojer-config
namespace: default
data:
moclojer.yml: |
- endpoint:
method: GET
path: /health
response:
status: 200
body: >
{"status": "ok", "service": "moclojer"}
- endpoint:
method: GET
path: /api/users
response:
status: 200
body: >
{"users": [{"id": 1, "name": "Alice"}]}2. Deployment
3. Service
π¦ Deploy
π§ Advanced Configurations
Horizontal Pod Autoscaler
Ingress (NGINX)
β
Best Practices
Do β :
Use ConfigMaps for configuration
Set resource limits
Configure health checks
Use specific image tags (not
latest)Enable horizontal scaling
Don't β:
Don't hardcode configs in images
Don't skip health checks
Don't use excessive resources
π See Also
Last updated
Was this helpful?