YOU ARE STANDING AT THE END OF A ROAD BEFORE A SMALL BRICK BUILDING. AROUND YOU IS A FOREST.
A SMALL STREAM FLOWS OUT OF THE BUILDING AND DOWN A GULLY.
Simple Hello, World! container sample used with a Kubernetes Ingress Controller. Implemented with the Python 3 Flask microframework and running with Green Unicorn Python WSGI HTTP Server.
If you don't want to actually run the container locally (it's only a Hello, World! one), skip to the Nginx Kubernetes Ingress Controller section
You can run this locally if you wish to but it's already pushed to Docker Hub, see Building & Deployment.
python3 -m venv env
. env/bin/activate
pip3 install -r requirements.txt
python3 app/hello.py
3. Visit the application at http://localhost:5000.
pytest
This app is provided as with a Dockerfile which is used to build a container. This should then be pushed to a container registry.
This container is already pushed to the betandr/hello-world repo at Docker Hub and this container is used in this example.
Now we can create the ingress controller for this Hello, World! container.
kubectl create -f https://raw.githubusercontent.com/kubernetes/contrib/master/ingress/controllers/nginx/examples/default-backend.yaml
kubectl expose rc default-http-backend \
--port=80 \
--target-port=8080 \
--name=default-http-backend
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout selfsigned.key \
-out selfsigned.crt
openssl dhparam -out dhparam.pem 2048
kubectl create secret tls tls-certificate \
--key selfsigned.key \
--cert selfsigned.crt
kubectl create secret generic tls-dhparam \
--from-file=dhparam.pem
kubectl apply -f rbac.yaml
kubectl create \
-f k8s/nginx-ingress-controller_deployment.yaml \
-f k8s/nginx-ingress-controller_service.yaml
kubectl get services | grep nginx
kubectl get pods | grep nginx
kubectl create \
-f k8s/hello-world_deployment.yaml \
-f k8s/hello-world_service.yaml \
-f k8s/hello-world_ingress.yaml
kubectl describe ingress hello-world