Hello Kubernetes
A Hello World web app in plain Python, for trying out a deployment or debugging requests inside a cluster. Its page shows a configurable hello text (HELLO_TEXT), the pod's namespace, service account, pod and node names and IP addresses, and a fixed set of request headers such as Host, User-Agent and X-Forwarded-For. /headers returns every request header as plain text.
registry.gitlab.com/hosstio/docker-images/hello-kubernetes/main:latestSource: hosstio/docker-images/hello-kubernetes
Usage
Docker
docker run --interactive --tty --publish 8000:8000 registry.gitlab.com/hosstio/docker-images/hello-kubernetes/main:latestBrowse to http://127.0.0.1:8000. Set HELLO_TEXT to change the hello text:
docker run --interactive --tty --publish 8000:8000 --env HELLO_TEXT="Foobar!" registry.gitlab.com/hosstio/docker-images/hello-kubernetes/main:latestThe Kubernetes values come from downward API environment variables. Under docker run those fields show their placeholders, like ${KUBERNETES_NAMESPACE}.
Kubernetes
The source repository has a kubernetes.yaml with a Deployment that sets those environment variables, and a Service. Apply it from a clone of that repository:
kubectl apply --filename kubernetes.yaml