Cloud Native Resource Monitoring Python App on K8s!
Things you will Learn 🤯
Python and How to create Monitoring Application in Python using Flask and psutil
How to run a Python App locally.
Learn Docker and How to containerize a Python application
Creating Dockerfile
Building DockerImage
Running Docker Container
Docker Commands
Create ECR repository using Python Boto3 and pushing Docker Image to ECR
Learn Kubernetes and Create EKS cluster and Nodegroups
Create Kubernetes Deployments and Services using Python!
Prerequisites !
(Things to have before starting the projects)
AWS Account.
Programmatic access and AWS configured with CLI.
Python3 Installed.
Docker and Kubectl installed.
Code editor (Vscode)
✨Let’s Start the Project ✨
Part 1: Deploying the Flask application locally
Step 1: Clone the code
Clone the code from the repository:
Step 2: Install dependencies
The application uses the
psutil and Flask, Plotly, boto3 libraries. Install them using pip:Step 3: Run the application
To run the application, navigate to the root directory of the project and execute the following command:
This will start the Flask server on
localhost:5000. Navigate to http://localhost:5000/ on your browser to access the application.Part 2: Dockerizing the Flask application
Step 1: Create a Dockerfile
Create a
Dockerfile in the root directory of the project with the following contents:Step 2: Build the Docker image
To build the Docker image, execute the following command:
Step 3: Run the Docker container
To run the Docker container, execute the following command:
This will start the Flask server in a Docker container on
localhost:5000. Navigate to http://localhost:5000/ on your browser to access the application.Part 3: Pushing the Docker image to ECR
Step 1: Create an ECR repository
Create an ECR repository using Python:
Step 2: Push the Docker image to ECR
Push the Docker image to ECR using the push commands on the console:
Part 4: Creating an EKS cluster and deploying the app using Python
Step 1: Create an EKS cluster
Create an EKS cluster and add node group
Step 2: Create a node group
Create a node group in the EKS cluster.
Step 3: Create deployment and service
make sure to edit the name of the image on line 25 with your image Uri.
Once you run this file by running “python3 eks.py” deployment and service will be created.
Check by running following commands:
Once your pod is up and running, run the port-forward to expose the service
1 like · 9 views · Jul 20, 2025
Developed a cloud-native resource monitoring app using Python, Docker, and Kubernetes.