A buggy application to illustrate Docker and Kubernetes features (mainly auto-restart and limits) :
| Name | Description | Default |
|---|---|---|
APP_PORT |
Listening port | 3000 |
APP_COLOR |
A color to illustrates env vars handling and blue/green deployments | null |
LOG_FORMAT |
Log format to illustrate JSON parsing ("simple" or "json") | "simple" |
LOG_LEVEL |
Log level ("debug", "verbose", "info", "warn", "error") | "info" |
See compose.yml :
# start on http://localhost:3000
docker compose up -d --build
# simulate crash
curl -X POST http://localhost:3000/api/bug/crash
# simulate memory leak
while true; do curl -X POST -sS http://localhost:3000/api/bug/memory-leak ; echo; sleep 1; doneIn one terminal :
# deploy
kubectl -k manifests
# To watch pods restarts :
watch kubectl get pods -o wide
# To watch pods CPU / RAM :
watch kubectl top podsIn another terminal :
# create temp pod
kubectl run terminal --rm -it --image=ghcr.io/mborne/terminal:latest --restart=Never -- /bin/sh
# get metadata
curl -sS http://debug/api/metadata | jq
# crash random pod
curl -X POST -sS http://debug/api/bug/crash | jq
# simulate memory leak
while true; do curl -X POST -sS http://debug/api/bug/memory-leak | jq ; sleep 5; done# install stress-ng
sudo apt-get update
sudo apt-get install -y stress-ng
# install dependencies
npm install
# start on http://localhost:3000
npm run start