GoGstickGo/httpbin-deployment

★ 0Forks 0MakefileGitHub ↗Compare

README

HTTPBin Kubernetes Deployment

A production-ready Kubernetes deployment of HTTPBin with best practices for security, reliability.

Overview

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

Prerequisites

  • Kubernetes cluster (v1.19+) - see Local Testing with k3d below
  • kubectl configured to access your cluster
  • make utility installed

Local Testing with k3d

For local testing, we recommend using k3d (k3s in Docker) - a lightweight Kubernetes distribution.

Install k3d

macOS:

brew install k3d

Linux:

curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash

Windows (PowerShell):

choco install k3d
# or
scoop install k3d

Create Local Cluster

# 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

Gotchas

  • 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 to k3d

# Deploy httpbin
make deploy

# Verify deployment
make verify

# Access via port-forward
make port-forward
# Visit http://localhost:8080

Delete Cluster

# When done testing
k3d cluster delete httpbin-test

Deployment Features

Even Distribution

  • Pod Anti-Affinity: Spreads pods across different nodes
  • 3 Replicas: Ensures high availability
  • Rolling Updates: Zero-downtime deployments

Security Best Practices

  • Resource limits (CPU: 200m, Memory: 128Mi)
  • Resource requests (CPU: 100m, Memory: 64Mi)
  • Non-root user configuration ready

Health Checks

  • Liveness Probe: Checks /status/200 every 10s
  • Readiness Probe: Checks /status/200 every 5s
  • Automatic restart on failure

Verification

The deployment includes multiple verification methods:

Verification

make verify

Will run test job and it will curl the endpoint.

3. Manual Verification

make test-local

License

This deployment configuration is provided as-is for educational and production use.

Contributors

GoGstickGo

Issues