How duclong06/face-detection-ml-system works
Main Components
• ML Service (API): Represent the face detection API (located in the “api” folder). This is where the core business logic (e.g., main.py, my_yolo.py) runs.
• Deployment and Orchestration: Include the Kubernetes layer (GKE) that hosts your containers. Represent the Helm charts (in “charts/face-detection” and “charts/nginx-ingress”) that deploy the API service and manage the ingress.
• Cloud Infrastructure: Show the infrastructure components (managed by Terraform and Ansible under “infrastructure”) used for provisioning GCP resources and configuring the cluster.
• Observability Stack: Include the monitoring and logging tools such as Prometheus, Grafana (via kube-prometheus-stack), ELK stack (Elasticsearch, Logstash, Kibana), and Jaeger for distributed tracing. Note that observability configurations exist in “monitoring/K8s” for the cluster and “monitoring/Local” for local testing.
Relationships and Interactions
• The ML Service is containerized and deployed on the GKE cluster, with the Kubernetes Ingress (configured via Helm charts in “charts/nginx-ingress”) managing external traffic.
• The CI/CD pipeline (Jenkins) automates the process: it builds Docker images (referenced in the “scripts” directory and Dockerfiles in API and Jenkins locations), pushes them to a container registry, and triggers Helm upgrades to update deployments.
• The infrastructure layer (Terraform and Ansible) provisions the GKE cluster and required network/security configurations. It also handles generate SSH keys and service accounts for deployment.
• The Observability Component collects metrics (Prometheus), offers dashboards (Grafana), and manages logs (ELK stack) alongside distributed tracing (Jaeger) that monitor the running services in the cluster.
Architectural Patterns and Principles
• Containerization and Orchestration: Emphasize the usage of Docker, Kubernetes (GKE) and Helm charts to encapsulate and deploy microservices.
• CI/CD and DevOps Automation: Outline the pipeline that integrates code validation, automated testing, image building, and automated deployment.
• Infrastructure as Code: Note the use of Terraform and Ansible for provisioning cloud resources and automating environment configuration.
• Observability and Monitoring: Detail the stack’s strategies to capture metrics, logs, and traces to ensure the system’s health is continuously monitored.
Technologies, Frameworks, and Tools
• Languages/Frameworks: Python for the API service.
• Container Tools: Docker, Docker Compose.
• Orchestration & Deployment: Kubernetes (GKE), Helm, and Helmfile.
• Infrastructure Automation: Terraform, Ansible.
• CI/CD: Jenkins.
• Monitoring & Logging: Prometheus, Grafana, ELK Stack (Elasticsearch, Logstash, Kibana), and Jaeger.
• Other DevOps utilities: Google Cloud SDK, kubectl, helm, and related CLI utilities.
• Each component should be clearly labeled (e.g., “Face Detection API”, “Nginx Ingress”, “GKE Cluster”, “Terraform/Ansible Infrastructure”, “Jenkins CI/CD”, “Prometheus/Grafana”, “ELK Stack”, “Jaeger”).
• Request flows from users -> ingress -> API service.
• Deployment flows from Jenkins to the container registry and then to GKE (via Helm charts).
• Data flows from running containers toward observability tools.
• Interconnection notes where important (e.g., “API Service deployed via Helm”, “Infrastructure provisioned with Terraform”, “Logs aggregated in ELK”).