Skip to content

Python App - Containerized, K8s AWS deployment, K8s manifests

License

Notifications You must be signed in to change notification settings

jakshaym1234/python-app

Repository files navigation

python-app

Python App - Containerized, K8s AWS deployment, K8s manifests

Structure to the Mono Repo:

image

  1. All Github Actions pipelines are maintained in .github/workdflows
  2. All Application Code and Dockerfile for containerizing the Python App are maintained in Application-Code
  3. All IaC Terraform Code to deploy the EKS cluster is maintained in K8s-Terraform-Code
  4. All K8s manifest to deploy the Python App are maintained in K8s-Deployment-Manifests

Secrets used by CI/CD pipelines are kept in GitHub Secrets(not coded in Pipelines)

image

Pipelines created (present in .github/workflows):

1. Package the Python App into a Docker container and push it to Docker Hub Registry (docker-image.yml)

Steps:

  1. Login to Docker Hub Registry
  2. Build the Docker image from the Dockerfile and Source Code in Application-Code folder
  3. Push built image to Docker HUB Registry
  4. Delete the Local Image Built (House-keeping)

Screenshots for Point 1:

Image in Docker Hub:

image

Testing locally:

image image

2. IaC TF code to deploy EKS cluster (k8s-terraform.yml)

Steps:

  1. Checkout the Github Repo
  2. Configure AWS Credentials CLI for TF deploy to take place.
  3. Setup Terraform on build machine
  4. TF Init
  5. TF Plan
  6. TF Apply with auto-approve set to true

Note: I have stored the state file in a private S3 bucket that I hosted for testing purposes

image

Screenshots for Point 2:

Cluster deployed:

image

Worker Nodes:

image

3. Flow to destroy cluster for house-keeping (k8s-terraform-destroy.yml)

4. Flow to deploy K8s object into the EKS cluster(k8s-deployments.yml)

Steps:

  1. Checkout the Github Repo
  2. Kubectl install on build machine
  3. Config AWS credentials
  4. Get Kube config from EKS using AWS CLI
  5. Login to the Docker HUB Registry
  6. Kubectl commands to deploy the K8s objects Service and Deployment

Screenshots for Point 4:

Kubectl to get status if K8s objects:

image

Access the app from the browser using the EXTERNAL-IP stated above

image

Screenshots for PIPELINES Working:

Docker Build pipeline:

image image

TF INIT PLAN APPLY pipeline:

image image

K8s objects deploy pipeline:

image image

About

Python App - Containerized, K8s AWS deployment, K8s manifests

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published