Skip to content

Latest commit

 

History

History
52 lines (36 loc) · 1.36 KB

README.md

File metadata and controls

52 lines (36 loc) · 1.36 KB

hello-container

Simple container for testing and demonstrating

  • container and pod networking, and
  • (rolling) deployment updates.

The container runs an nginx server that (from the / root route) returns either HTML or TXT response with Hello! 👋 message as well as containers hostname and address.

Usage

To create a deployment and expose it from your Kubernetes cluster, run:

kubectl create deployment --image=ghcr.io/upcloudltd/hello hello
kubectl expose deployment hello --port=80 --target-port=80 --type=LoadBalancer
kubectl get svc -w

This process might take a few minutes. After external IP for hello service is visible, use it to test that pod is reachabe from the internet. For example:

$ curl http://lb-${id}.upcloudlb.com

Environment variable NGINX_PORT can be used to change port that Nginx listens to.

$ docker run -e NGINX_PORT=8080 ghcr.io/upcloudltd/hello

Development

Build hello-container image with:

docker build . -t hello-container

# With version note
docker build . -t hello-container --build-arg "VERSION_NOTE=at $(git rev-parse HEAD)"

# With custom emoji and greeting
docker build . -t hello-container \
  --build-arg "VERSION_NOTE=at $(git rev-parse HEAD)" \
  --build-arg "EMOJI=🐄" \
  --build-arg "HELLO=Moo"

Run hello-container with:

docker run -i -p 8080:80 --rm hello-container