Step-by-Step Guide to Using GitOps and Service Mesh for Microservices in Minikube ( Optimizing Microservices Deployment )

Step-by-Step Guide to Using GitOps and Service Mesh for Microservices in Minikube ( Optimizing Microservices Deployment )

Optimizing Microservices Deployment

Document for Optimizing Microservices Deployment with GitOps and Service Mesh in Minikube In this blog, we'll explore how to deploy and manage microservices effectively using GitOps and Service Mesh technologies in a Minikube environment. We'll cover all the steps, from setting up Minikube to deploying services and configuring Istio for traffic management.

Prerequisites Before we begin, ensure you have the following installed and configured on your system:

Minikube: For running a local Kubernetes cluster

Kubectl: Command-line tool for interacting with Kubernetes.

Helm: Kubernetes package manager.

Istio: Service mesh platform.

Argo-cd: To manage GitOps workflows and interact with the ArgoCD server. A GitHub repository for GitOps workflow.

For Required Installations

AWS Account: youtu.be/d4aJUubHWTk?si=vP1VebvjZaNWOirA

Gitbash: git-scm.com/downloads

AWS CLI: docs.aws.amazon.com/cli/latest/userguide/ge..

Kubectl: kubernetes.io/docs/tasks/tools

EKCTL:eksctl.io/installation

Helm: Helm | Installing Helm

Istio CLI: github.com/istio/istio/releases/tag/1.24.2

Step 1: Start Minikube First, start Minikube with sufficient resources for Istio and microservices

minikube start --memory=8192 --cpus=4

Verify the Minikube status:

minikube status

Start minikube and see the status

Step 2: GitOps Workflow

1. Install ArgoCD:

kubectl create namespace argocd kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml

2. Access the ArgoCD UI:

kubectl port-forward svc/argocd-server -n argocd 8080:443

3. Login to ArgoCD:

Retrieve the default admin password:

kubectl get secret argocd-initial-admin-secret -n argoc d -o jsonpath="{.data. Password}" | base64 -d

Open your browser and navigate to localhost:8080 .
Use the username adm
in and the retrieved password to log in.

4. Connect your GitHub repository for GitOps:

Create a new ArgoCD application pointing to your GitHub repository.

Define the path to the Kubernetes manifests in the repository.

Sync the application to deploy resources to your cluster

Step 3 : GitHub Repository Setup

Initialized a GitHub repository to store application code and configuration files.

Added YAML files for the Bookinfo application to the repository, which represent the deployment configurations for the microservices.

Step 4 : Deploying the Application

Verified the status of deployed pods using kubectl commands.

Used kubectl port-forward to forward the product page service port for local access. the application was accessible at 127.0.0.1/productpage.

Integrated ArgoCD for automatic redeployment, enabling seamless updates upon pushing changes to the GitHub repository.

kubectl port-forward svc/productpage -n default 8081:9080

Step 5: Install Istio

1. Download the Istio CLI:

curl -L https://istio.io/downloadIstio | sh - cd istio-*

export PATH=$PWD/bin:$PATH

2. Install Istio using the demo profile:

istioctl install --set profile=demo -y

3. Label the default namespace for automatic sidecar injection: kubectl label namespace default istio-injection=enabled Verify the installation:

kubectl get pods -n istio-system

Verify the installation:

kubectl get pods -n istio-system

Step 6: Traffic Management with Istio

1. Deployed Istio add-ons, including Prometheus, Grafana, and Kiali, for comprehensive monitoring.

cd "C:\Users\Downloads\istio-1.24.2-win-amd64\istio-1.24.2 \samples

kubectl apply -f addons/

2. Verified add-on components using kubectl get pods -n istio-system.

kubectl get pods -n istio-system

Step 7 Install Kiali: Kiali provides a visualization of the Istio service mesh. Install it with the following command:

kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.10/samples/addons/kiali.yaml

Accessed the Kiali dashboard to visualize the service mesh and traffic flow.

istioctl dashboard kiali

kubectl port-forward svc/kiali -n istio-system 20001:20001

Open localhost:20001 in your browser to visualize the mesh.

Step 8: Monitoring and Enhancing Observability with Grafana

1. Access Grafana for metrics:

kubectl port-forward svc/grafana -n istio-system 3000:3000

To delete all :

kubectl delete all --all

Conclusion

By combining GitOps with Service Mesh in Minikube, you can optimize your local microservices deployment for efficient management, traffic control, and observability. This approach offers a simplified, yet powerful, setup for local Kubernetes development, ensuring that your microservices architecture remains scalable and easy to monitor.