Skip to content

This project aims to create a k8s cluster that uses a Flask app to fetch the sample data from MYSQL DB. and Deploy the cluster using Helm charts.

Notifications You must be signed in to change notification settings

vgeorgework/Flaskdemo

Repository files navigation

Flask app demo project Awesome

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.

Pre-requisites

  • Minikube installed and running.
  • Virtualization enabled in the host.
  • Docker installed.
  • Helm installed.
  • Kubectl CLI installed.

Custer Architecture

Cluster Architecture image

Summary

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.

To run this project execute below commands using minikube.

# 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.

To execute the project using helm chart:

  1. clone the github repo using #git clone https://github.com/vgeorgework/Flaskdemo.git
  2. change directory #cd Flaskdemo
  3. 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.

About

This project aims to create a k8s cluster that uses a Flask app to fetch the sample data from MYSQL DB. and Deploy the cluster using Helm charts.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published