This is a demo project to show how to deploy a two tier application using a kubernetes cluster (minikube). Helm charts are used to deploy the application.
- Minikube installed and running.
- Virtualization enabled in the host.
- Docker installed.
- Helm installed.
- Kubectl CLI installed.
The flaskapp image that we created using Dockerfile is pushed to dockerhub public repository(flaskapp). The cluster creates a flaskapp service to redirect traffic to front end pods which is replicated by replicaset. the Mysql service is deployed by statefulset. The pod mysql uses a persistant volume claim to claim the persistant volume. The cluster also creates Configmaps and Secrets to setup environment variables. Helm chart is used to deploy the entire kuberneties cluster.
# minikube start
# eval $(minikube docker-env)
# cd Flaskdemo/k8s_resources/
Execute both deployment files inside mysql and flaskapp folders respectively using k8s.
Example :# kubectl create -f mysql-svc-deploy.yaml
this will deploy all the configuration for k8s cluster.
# minikube service flask-web-svc
# will deploy the service outside cluster uses host browser for access.
- clone the github repo using
#git clone https://github.com/vgeorgework/Flaskdemo.git
- change directory
#cd Flaskdemo
- execute setup.sh file #sh setup.sh //will create flask app and MySQL services in your PC and opens up your default browser.
For your ease of use, I created a "setup.sh" script to execute all the steps automatically.