Flask application to deploy the zero downtime app on the cluster
Before getting started, ensure you have the following installed:
- Docker
- kubectl utility
Follow these steps to run the Flask application locally using Docker:
-
Clone the Repository:
git clone <repository-url> cd <repository-folder>
-
Build Docker for you application:
- Build a Dockerfile for you app
- Build docker image
docker build -t <image_name>:<tag_name> .
- Config changes:
- Replace the image name in the app deployment resource. (This should ideally be more modularised. You should be able to give all info to terraform in the config file.)
- MySql Connections: # Replace these fields from terraform/db/main.tf config resource This should ideally be more modularised. You should be able to give all info to terraform in the config file.
- Push it to a repository like DockerHub (push it to minikube in case of local cluster)
-
Run terraform code to deploy app, its corresponding db, prometheus and fluentd:
terraform plan terraform apply
You can run kubectl commands to check that all service, deployment, pods, ingress are running as expected.
- I have also created terraform code to deploy Jenkins.
- This is a basic module. A lot of necessary improvements on security practices and modularising can be done.
- Storing the tfstate in S3.
- Modularising tf code
- Setting up non root for various application such as Docker, mysql etc.
- Writing better and more test cases covering all tests.