Task Overview:
This week, you’ll work on deploying a multi-component microservices application to Kubernetes using GitOps principles and automating workflows across three repositories:
- Infra Repo: Manage cloud infrastructure provisioning and configuration with Terraform and Ansible.
- Application Repo: Handle microservices source code, Dockerfiles, and CI pipelines for Docker image management.
- K8 Manifests Repo: Store Kubernetes manifests for the microservices application (excluding ArgoCD manifests, which are managed by Ansible).
📌 Steps to Complete the Task:
Create the following repositories:
- Infra Repo: Terraform and Ansible configurations for Kubernetes cluster and tool installations.
- Application Repo: Fork and clone the current repository (the one you are reading the instructions from). This repository will contains the microservices source code, Dockerfiles, and CI pipelines for Docker image management.
- K8 Manifests Repo: Kubernetes manifests for deploying the microservices application.
- Use Terraform to provision a Kubernetes cluster on your chosen cloud provider.
- Use Terraform to trigger Ansible to perform the following tasks, with each task implemented as an Ansible role:
- ArgoCD Installation:
- Install ArgoCD on the cluster using Helm.
- ArgoCD Application Setup:
- Create and manage ArgoCD application manifests to deploy the microservices application from the Application Repo.
- Logging Stack Setup:
- Deploy EFK (Elasticsearch, Fluentd, Kibana) or ELK (Elasticsearch, Logstash, Kibana) using Helm.
- Monitoring Stack Setup:
- Install the Kube-Prometheus Stack using Helm for metrics and monitoring.
- ArgoCD Installation:
-
Fork and Clone the Current Repo:
- Fork and clone the current repository (the one you’re reading the instructions from) into your own GitHub account. This will be the Application Repo.
-
Pre-build Docker Images:
- Each microservice already has its Dockerfile.
- Build Docker images for all services and push them to a public Docker Hub repository.
-
CI Pipeline for Docker Images:
- Create a CI pipeline for each microservice in the Application Repo.
- Each CI pipeline should:
- Build the Docker image.
- Scan the image for vulnerabilities using Trivy.
- Push the image to the Docker Hub repository.
- Trigger conditions for CI pipelines:
- Manually.
- When changes are made to the specific folder containing the Dockerfile for a given microservice.
- Store all Kubernetes manifests for deploying the microservices application, such as:
- Deployments.
- Services.
- ConfigMaps.
- PersistentVolumes, etc.
- Ensure these manifests reference the pre-built Docker images from Docker Hub.
- Exclude ArgoCD manifests, as they are managed by Ansible in the Infra Repo.
📋 Requirements:
-
Infrastructure Management:
- Use Terraform to provision the Kubernetes cluster.
- Use Ansible roles for installing and configuring:
- ArgoCD (via Helm).
- EFK/ELK stack (via Helm).
- Kube-Prometheus stack (via Helm).
- ArgoCD application manifests (for deploying the microservices app).
-
Application Management:
- CI pipelines in the Application Repo must include:
- Docker image build.
- Trivy vulnerability scan.
- Docker Hub push.
- Docker images must be pre-built and uploaded to Docker Hub for all microservices.
- CI pipelines in the Application Repo must include:
-
Kubernetes Deployment:
- Microservices application is deployed via ArgoCD, pulling manifests from the K8 Manifests Repo.
-
Logging and Monitoring:
- EFK/ELK stack and Kube-Prometheus stack are set up and functional.
-
Triggering Conditions:
- Ansible tasks are triggered by Terraform.
- CI pipelines are triggered manually or when changes are detected in a microservice's folder in the Application Repo.
✅ Acceptance Criteria:
-
Repositories Created and Used:
- Infra Repo (Terraform and Ansible configurations).
- Application Repo (microservices source code, Dockerfiles, and CI pipelines).
- K8 Manifests Repo (Kubernetes manifests for microservices).
-
Infrastructure Provisioning:
- Kubernetes cluster is provisioned with Terraform.
- Ansible successfully configures the cluster with ArgoCD, EFK/ELK, and Kube-Prometheus stack.
-
Functional Deployment:
- Microservices application is successfully deployed to Kubernetes using ArgoCD.
- Logging and monitoring systems are operational.
-
Docker Images Pre-Built and Published:
- Docker images for all microservices are available on Docker Hub.
-
Pipeline Validations:
- CI pipelines are functional for each microservice and meet the stated trigger conditions.
📝 Submission Instructions:
Submit the following by 11:59 PM WAT, Monday, 23rd December 2024:
- Links to the three GitHub repositories.
- Screenshots of:
- Kubernetes cluster.
- Logs and monitoring dashboards (EFK/ELK and Kube-Prometheus).
- CI pipelines (Trivy scan results and Docker Hub upload success).
- A detailed blog post documenting your process, including the architectural diagram