Introduction
This project shows how to set up a Kubernetes cluster using AWS EKS (Elastic Kubernetes Service) and apply GitOps principles with ArgoCD for continuous deployment. Istio is used as a service mesh to manage traffic and support canary deployments. The project features a polyglot microservices-based website, built using Python, Ruby, Java, and Node.js. Key technologies include AWS, eksctl, kubectl, ArgoCD, Istio, Kiali, Prometheus, and Grafana. These tools work together to create an efficient DevOps pipeline, ensuring smooth deployments, monitoring, and scaling of the application.
Problem Statement:
Managing Kubernetes clusters at scale.
Automating deployments with GitOps practices.
Ensuring traffic control and service reliability.
Improving the monitoring and health visibility of applications and the Kubernetes cluster.
Tech Stack Overview:
EKS (Amazon Elastic Kubernetes Service): A managed service for running Kubernetes, providing scalability and reliability.
ArgoCD: A tool that automates deployments using GitOps for Kubernetes.
Istio: A service mesh that helps manage traffic and enhance security between services.
Kiali: A tool that helps monitor and visualize the service mesh for better observability.
Prometheus: A tool for collecting metrics to monitor the health of Kubernetes and Istio workloads.
Grafana: A platform for visualizing the metrics collected by Prometheus, helping to gain insights and take action.
Let’s start with the creation of this project:
Prerequisite
Make sure you know these tools before doing this project.
📋 Software to be Install before building this project
1️⃣ AWS Account: Ensure your AWS account is active.
Need help? Watch this: https://youtu.be/d4aJUubHWTk?si=vP1VebvjZaNWOirA
2️⃣ Gitbash: Download and install it here: https://git-scm.com/downloads
3️⃣ AWS CLI: Download it here: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html Make sure to add the path to your environment variables.
4️⃣ Kubectl: Download it here: https://kubernetes.io/docs/tasks/tools/ Make sure to add the path to your environment variables.
5️⃣ EKSCTL: Download it here: https://eksctl.io/installation/
Make sure to add the path to your environment variables.
6️⃣ Istio CLI: Download it from GitHub: https://github.com/istio/istio/releases/tag/1.24.2
🔑 Also ensure you have active GitHub & Docker Hub accounts.
A basic understanding of Kubernetes, ArgoCD, Istio, Grafana, and Kiali is highly recommendable.
Configuration and cluster creation
Step 1: aws configure
Provide your AWS Access Key, Secret Key, default region, and output format (e.g., JSON).
Step 2: eksctl create cluster --name dev1project
Cluster creation is in progress. It takes around 20-25 minutes to create the cluster. Until then, move to the next step.
Setup GitHub Repository
Step 1: Create a local repository to store the configuration files and application code.
Step 2: Connect our local folder with the GitHub repository where we store our application file
Step 3: Check our GitHub repository; one readme file will be there.
step 4: Now download this bookinfo.yaml file to your local using this command:
curl -O https://raw.githubusercontent.com/vimallinuxworld13/eks_istio_bookinfo_app/refs/heads/master/bookinfo.yaml
step 5: Now push it to your GitHub Repository
git add .
git commit -m first "first file"
git push
Now we can see bookinfo.yaml file is in the GitHub Repository.
In the meantime, our cluster is created.
Install and Configure ArgoCD
Step 1: Start by creating a dedicated namespace for ArgoCD in the Kubernetes cluster.
kubectl create namespace argocd kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
Step 2: Install ArgoCD: Deploy Argocd into your Kubernetes cluster
Step 3: Check whether the ArgoCD namespace is created or not.
Command:
kubectl get ns
Step 4: Verify whether the pod is running or not
Command : kubectl get pods -n argocd
Step 5: Switch kubectl to use the ArgoCD namespace.
kubectl config set-context --current --namespace=argocd
argocd login --core
argocd admin intial-password -n argocd
kubectl port-forward svc/argocd-server -n argocd 8080:443
Step 6: Log in to ArgoCD
Step 7: Get the password of ArgoCD using this command
Step 8: Forward the ArgoCD server port to your local machine to access the UI.
Visit 127.0.0.1:800 to open ArgoCD dashboard
Step 9: Authenticate to the ArgoCD dashboard using
username: admin
password: copy from the terminal you got and paste it here.
Now we are on the dashboard of ArgoCD
Step 10: Now Click on the New app and create the app using these steps:
Copy the HTTPS code from your GitHub repository.
And paste it here:
keep namespace as the default
Now click on the create
Here our application is created
Here we can see our application is in healthy condition and properly synced with our GitHub
Deploy Application
Now, return to the terminal and check all the pods running in the default namespace to make sure everything is working smoothly.
command: kubectl get pods -n default
Now we will check for the application that we created.
command: kubectl get application
Here we can see all the namespace running.
command: kubectl get ns
Now, use kubectl port-forward
to forward the product page service port to your local machine and access the application.
kubectl port-forward svc/productpage -n default 80:9080
If you visit http://127.0.0.1:80 you will get this page.
To view the application visit 127.0.0.1/productpage
Any updates you make in the code and push to the GitHub repository will be automatically deployed by ArgoCD.
Install Istio
Use istioctl to install Istio with the demo profile in the Kubernetes cluster.
istioctl install --set profile=demo
kubectl get pods -n istio-system
kubectl label namespace default istio-injection=enabled
kubectl delete pods --all -n default
kubectl get pods -n default
Verify Installation: Ensure Istio is installed correctly by checking its components, labeling the default namespace for Istio injection, and applying the Bookinfo gateway configuration to manage traffic flow.
We can also describe any of the pods using the following command:
command : kubectl describe pod <pod-name> -n default
Now we need to download one more file. Download this file to your local system where you have the bookinfo.yml file. After that, from that directory, push the file to your GitHub account.
curl https://raw.githubusercontent.com/vimallinuxworld13/devops_project_bookinfo/refs/heads/master/bookinfo-gateway.yaml -o bookinfo-gateway.yaml
git add .
git commit -m .
git push
After that, we create a gateway in the default namespace.
command: kubectl get geteway -n default
we can also check the virtual services in the default namespace.
Command: kubectl get vs -n defualt
The load balancer is created via AWS and we get a link to access our website via the browser:
aed1e0319a6e845e5aa4b515ca709e3b-60789792.ap-south-1.elb.amazonaws.com/productpage
We can download all the files needed to install Istio add-ons. Apply Istio add-ons like Prometheus, Grafana, and Kiali for monitoring.
Command: kubectl apply -f addons/
Now we will verify whether all our pods in the Istio namespace are available.
Command: kubectl get pods -n istio-system
We will check the services once
Command: kubectl get svc -n istio-system
A Jaeger collector is a software component that retrieves traces from the Jaeger agent. It checks, processes, and stores the traces in the database.
Traffic Management and Monitoring
We access the Kiali Dashboard to visualize the service mesh and monitor traffic flow.
Command: istioctl dashboard kiali
Here we can see the dashboard of kiali
Traffic Shifting: Use Kiali or the Istio CLI to set up traffic shifting and carry out canary deployments.
Monitor with Prometheus:
Command : istioctl dashboard prometheus
Here we can see the dashboard of Prometheus.
Prometheus will collect and store metrics from the application.
Monitor with Grafana
istioctl dashboard grafana
Use Grafana to create dashboards and visualize metrics like response time and error rates.
Application Structure
This project uses a microservices approach, where each component or service works independently. This makes it easy to develop, deploy, and scale them separately.
Microservices Breakdown:
Productpage (Python): This is the main interface for users to view product details.
Details (Ruby): Responsible for fetching and displaying additional product information.
Reviews (Java): Handles the display of product reviews and supports different versions for testing new updates.
Ratings (Node.js): Manages the ratings for products.
Communication Setup:
Istio Gateway: All incoming traffic from users is first routed through this gateway into the Kubernetes system.
Private Load Balancers: These manage internal traffic and help services within Kubernetes communicate with each other.
Service Interaction: Microservices communicate with each other, aided by the Istio service mesh.
Key Features:
GitOps: Continuous deployment is managed using ArgoCD, ensuring that the cluster's state is always aligned with the configurations in the GitHub repository.
Service Mesh: Istio is used to handle traffic management, ensure security, and monitor interactions between services.
Monitoring Tools: Tools like Prometheus and Grafana allow monitoring and data visualization, while Kiali offers insights into how the services are interacting within the service mesh.
Modular Design: The microservices are designed to work independently, allowing each to be scaled and deployed without affecting the others.
Future Improvements: Here are some ideas for future upgrades to the project:
CI Pipeline: Automating the build and testing phases to ensure smoother deployments.
SonarQube Integration: Adding SonarQube to automatically check the quality of the code during the CI/CD process.
End-to-End Testing: Setting up automated tests to ensure the system remains reliable and performs as expected.
Key Tools and Technologies in DevOps Workflow: These are the key technologies that help run the project efficiently:
AWS & eksctl: Provide the cloud infrastructure and tools needed to manage Kubernetes clusters.
Kubernetes & kubectl: Kubernetes orchestrates the containerized services, and kubectl is used to manage and interact with the clusters.
GitHub & ArgoCD: GitHub stores the code, while ArgoCD is used for continuous deployment through GitOps practices.
Istio & Kubernetes: Istio handles the traffic routing and security, while Kubernetes manages the containerized services.
Monitoring Tools (Prometheus, Grafana, Kiali, Jaeger): These are used to monitor, visualize, and troubleshoot the application in real-time.
This smooth workflow ensures that each step, from code changes to deployment, is handled efficiently with transparency and control.
Conclusion
This project demonstrates a comprehensive DevOps pipeline, using a wide array of tools to manage the development, deployment, and monitoring of a microservices-based application. By leveraging AWS EKS, ArgoCD, Istio, and several monitoring tools, the project ensures that the application is scalable, reliable, and easy to manage.