A very simple image serving environment variables over HTTP
368
A very simple image serving environment variables over HTTP. I use this image to test kubernetes ClusterIP service.
Run docker container and expose port
docker run --rm -p8888:8888 thenaim/httpenv
Test endpoint
curl http://localhost:8888
curl http://localhost:8888/blue
curl http://localhost:8888/green
curl http://localhost:8888/red
In another window, watch the pods (to see when they are created):
kubectl get pods -w
Create a deployment for this very lightweight HTTP server:
kubectl create deployment httpenv --image=thenaim/httpenv
Scale it to 10 replicas:
kubectl scale deployment httpenv --replicas=10
Expose the HTTP port of our server. We'll create a default ClusterIP service
kubectl expose deployment httpenv --port 8888
Look up which IP address was allocated:
kubectl get service
Let's obtain the IP address that was allocated for our service:
IP=$(kubectl get svc httpenv -o go-template --template '{{ .spec.clusterIP }}')
Generate URL
echo http://$IP:8888/
Run Busybox to access ClusterIP
kubectl run busybox --image=radial/busyboxplus:curl -i --tty
Send a few requests:
curl http://$IP:8888/
Too much output? Filter it with jq:
curl -s http://$IP:8888/ | jq .HOSTNAME
Others
curl http://$IP:8888/blue
curl http://$IP:8888/green
curl http://$IP:8888/red
Content type
Image
Digest
Size
6 MB
Last updated
almost 5 years ago
docker pull thenaim/httpenv