Mysql and Flask app deployed on AWS using EKs Cluster using ECR private repositary, using terraform and ansible to provision the infastrusture and configure the EC2 to be configured as Jenkins Master and deploying eth app, Deployed the App through jenkins pipeline by
- bulding mysql and flask images.
- pushing images to ECr repositaries.
- apply k8s mainfest.
- Triggering jenkins pipleline using github-webhook
- using default VPC
- EKS with 2 worker nodes
- 2 private REPO ECR
- EC2 with SG and IAM role to allow jenkins deploying on ECR and EKS
- Deployment for flask-app image with readiness and liveness
- ConfigMap for flask-app variables (deployment)
- ClusterIP service selects the deployment's pod
- Statefulset for mysql image with (pv and pvs)
- ConfigMap for mysql variables (statefulset)
- ClusterIP service selects the statefulset's pod
- Ingress using nginx-controller
Building Flask image and mysql image with database table
run
docker-compose up --build
to test the app locally put the url in the Browser
localhost:5002
- Configure jenkins
- Installing kubectl
- Installing AWSCli
- using Bash Script to apply Terraform and Ansible
sudo chmod +x bash.sh
-
Ansible will appear msg with jenkins password
-
Put jenkins-ec2-public-IP:8080 in the Browser and login the password
-
Installing suggusted Plugins and Creating user from the browser when loggin in
-
Adding AWS credentials in secret text
-
Adding Github credentials with github-token
Dashboard > Manage Jenkins > Credentials > system > Global credentials (unrestricted) + Add Credentials
from repo"s settings adding webhoob with jenkins's
the pipeline will be triggered and Build jenkinsfile stages