This project demonstrates how to deploy a simple Flask "Hello World" application on Kubernetes. It includes the necessary Kubernetes manifests for deployment, service, Ingress class, and Ingress resource.
- Kubernetes cluster (e.g., Minikube, kind, or a managed Kubernetes service)
- kubectl CLI tool
- Docker (to build and push the image)
Dockerfile: Dockerfile for building the Flask application imagedeployment.yaml: Kubernetes Deployment resourceservice.yaml: Kubernetes Service resourceingress-class.yaml: IngressClass resource (for NGINX Ingress controller)ingress.yaml: Ingress resource to route traffic
-
Build the Docker Image:
docker build -t your-dockerhub-username/hello-world-app:latest . docker push your-dockerhub-username/hello-world-app:latestReplace "hello-world-app" with your repository name on Docker Hub.
This step is not needed to run the example project as it already uses an image from public Docker Hub repository.
-
Applying Kubernetes Manifests
Use
make startcommand to apply Kubernetes manifests. This command will apply related Kubernetes files using commandkubectl apply -f <resource-file-name>. You can see Makefile for commands.Warning: If you get an error during creation of Kubernetes resources please run
make startcommand again. This should be fixed soon. -
Accessing the application
Use your browser or any API tool to send a GET request to your application. Application uses
http://localhost/hello-world-appas default. You should seeHello World!as response. -
Stopping the application
Use
make stopto delete all running Kubernetes resources related to application.