# abhizeetyadav/cloud-native-monitoring-application-on-kubernetes architecture

> Architecture diagram of the GitHub repository abhizeetyadav/cloud-native-monitoring-application-on-kubernetes, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abhizeetyadav/cloud-native-monitoring-application-on-kubernetes
- Repository: https://github.com/abhizeetyadav/cloud-native-monitoring-application-on-kubernetes

## Overview

##### Main Components to Identify
- Monitoring Application (app.py): This forms the core application built with Flask. It monitors system metrics using psutil and renders a UI from templates (e.g., templates/index.html).
- Docker Containerization: Represented by Dockerfile, encapsulating the application and its dependencies (as also listed by requirements.txt). This layer ensures the app runs in a consistent environment.
- AWS Integration Components:
- ECR Integration (ecr.py): Shows how the Docker image is managed and pushed to AWS Elastic Container Registry.
- EKS Orchestration (eks.py): Handles the interaction with Kubernetes, orchestrating deployments on AWS Elastic Kubernetes Service.
- External Tools & Dependencies: Mention AWS CLI, Kubernetes CLI (kubectl), and Python libraries (Flask, psutil, Boto3) that are essential for the build and deployment processes.

##### Relationships and Interactions
- The Flask Application (app.py) consumes system metrics and serves them via a web interface (using the HTML template in the templates directory).
- The Dockerfile packages this application and all its dependencies (including those defined in requirements.txt) into an image.
- The ecr.py script is used to automate the creation of an ECR repository and push the Docker image to it.
- The eks.py script automates the setup/deployment of the containerized application in a Kubernetes cluster (EKS). This shows the data flow from image creation to deployment in a cloud environment.
→ The creation of the application (app.py) which communicates with a front-end (templates).
→ The Docker build process consuming the Dockerfile and requirements.txt.
→ The process where ecr.py pushes this image to an ECR repository.
→ The use of eks.py to deploy the image from ECR into an EKS cluster.
→ External interactions with AWS services and CLI tools.

##### Architectural Patterns and Design Principles
- Separation of Concerns: The project is organized into distinct modules for monitoring (the application itself), containerization (Docker), and cloud orchestration (AWS ECR/EKS).
- Microservices/Modular Approach: Although it is a simple project, the separation of concerns with distinct scripts (ecr.py and eks.py) hints at a modular design where each component can be evolved independently.
- Containerization and Cloud-Native Principles: The system makes heavy use of Docker and Kubernetes (EKS) to ensure scalability and portability in different environments.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Application Layer
    subgraph "Application Layer"
        A("Monitoring Application (Flask & psutil)"):::app
        T("Web Frontend (Template: index.html)"):::app
    end
    A -->|"renders"| T

    %% Containerization Layer
    subgraph "Containerization Layer"
        D("Docker Containerization"):::container
        DF("Dockerfile"):::container
        RT("requirements.txt"):::container
        D ---|"configFrom"| DF
        D ---|"configFrom"| RT
    end
    A -->|"packagedInto"| D

    %% Cloud Integration Layer
    subgraph "Cloud Integration Layer"
        ECR("AWS ECR Repository"):::aws
        EKS("AWS EKS Cluster"):::aws
        ECR -->|"deployedTo"| EKS
    end
    D -->|"imagePushedTo"| ECR

    %% External Tools & Dependencies
    subgraph "External Tools & Dependencies"
        CLI("AWS CLI"):::external
        Kub("kubectl"):::external
        PY("Python Libraries (Flask,psutil,Boto3)"):::external
    end
    PY ---|"usedBy"| A
    CLI ---|"manages"| ECR
    Kub ---|"manages"| EKS

    %% Click Events
    click A "https://github.com/abhizeetyadav/cloud-native-monitoring-application-on-kubernetes/blob/main/app.py"
    click T "https://github.com/abhizeetyadav/cloud-native-monitoring-application-on-kubernetes/blob/main/templates/index.html"
    click DF "https://github.com/abhizeetyadav/cloud-native-monitoring-application-on-kubernetes/tree/main/Dockerfile"
    click RT "https://github.com/abhizeetyadav/cloud-native-monitoring-application-on-kubernetes/blob/main/requirements.txt"
    click ECR "https://github.com/abhizeetyadav/cloud-native-monitoring-application-on-kubernetes/blob/main/ecr.py"
    click EKS "https://github.com/abhizeetyadav/cloud-native-monitoring-application-on-kubernetes/blob/main/eks.py"

    %% Styles
    classDef app fill:#a3d5ff,stroke:#333,stroke-width:2px;
    classDef container fill:#ffe5a3,stroke:#333,stroke-width:2px;
    classDef aws fill:#d1ffd6,stroke:#333,stroke-width:2px;
    classDef external fill:#ffdfdf,stroke:#333,stroke-width:2px;
```
