A production-ready Kubernetes deployment of HTTPBin with best practices for security, reliability.
This project deploys the kennethreitz/httpbin container to Kubernetes with:
- Even distribution across cluster nodes
- Health checks and resource limits
- Minimal, clean configuration
- Automated deployment and verification
- Kubernetes cluster (v1.19+) - see Local Testing with k3d below
kubectlconfigured to access your clustermakeutility installed
For local testing, we recommend using k3d (k3s in Docker) - a lightweight Kubernetes distribution.
macOS:
brew install k3dLinux:
curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bashWindows (PowerShell):
choco install k3d
# or
scoop install k3d# Create a simple cluster
k3d cluster create httpbin-test
# Or create with port mapping for ingress
k3d cluster create httpbin-test \
--port "9100:9100@loadbalancer" \
--agents 3 \
--k3s-node-label "environment=app@agent:*"
# Verify cluster is ready
kubectl cluster-info
kubectl get nodes- Imagepull policy is set IfNotPresent due to the k3d was unable the pull from docker hub. After the cluster created please run the
make k3d-docker-registry
# Deploy httpbin
make deploy
# Verify deployment
make verify
# Access via port-forward
make port-forward
# Visit http://localhost:8080# When done testing
k3d cluster delete httpbin-test- Pod Anti-Affinity: Spreads pods across different nodes
- 3 Replicas: Ensures high availability
- Rolling Updates: Zero-downtime deployments
- Resource limits (CPU: 200m, Memory: 128Mi)
- Resource requests (CPU: 100m, Memory: 64Mi)
- Non-root user configuration ready
- Liveness Probe: Checks
/status/200every 10s - Readiness Probe: Checks
/status/200every 5s - Automatic restart on failure
The deployment includes multiple verification methods:
make verifyWill run test job and it will curl the endpoint.
make test-localThis deployment configuration is provided as-is for educational and production use.