This repo demonstrates setting up a GitOps pipeline using Argo CD for continuous deployment and Argo Rollouts for advanced deployment strategies within a Kubernetes environment. This automates the deployment and management of a simple web application.
- Docker installed on your machine.
- kubectl installed on your machine.
- Minikube installed on your machine.
-
Start Minikube with Docker as the Driver:
-
Setup and Configuration:
-
Created a GitHub repository to host the source code.
-
Install Argo CD on the Kubernetes cluster following the official documentation.
kubectl create namespace argocd kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
-
Install the Argo Rollouts controller in the Kubernetes cluster following the official guide.
kubectl create namespace argo-rollouts kubectl apply -n argo-rollouts -f https://github.com/argoproj/argo-rollouts/releases/latest/download/install.yaml
-
-
Creating the GitOps Pipeline: Dockerize the Application:
- Build a Docker image for the web application and push it to a public container registry. Here
docker build -t ritish134/web-app:v1 . docker push ritish134/web-app:v1
- Modified Kubernetes manifests in the Git repository to use the Docker image.
- Configured Argo CD to monitor the repository and automatically deploy changes to the Kubernetes cluster.
- Build a Docker image for the web application and push it to a public container registry. Here
-
Implementing a Canary Release with Argo Rollouts:
- Defined a rollout strategy using Argo Rollouts, specifying a canary release strategy.
- Triggered a rollout by updating the Docker image, pushing the new version to the registry, and updating the rollout definition.
- Monitored the rollout using Argo Rollouts to ensure successful completion of the canary release.
-
ImagePullBackOff and ErrImagePull Errors:
- Challenge: Encountered issues with pulling the Docker image during deployment.
- Resolution: Verified image availability, checked network connectivity, and ensured proper Docker and Kubernetes configurations.
-
Pending External IP for LoadBalancer Service:
- Challenge: Faced difficulties obtaining an external IP address for the LoadBalancer service.
- Resolution: Used port forwarding or NodePort service types for local Kubernetes clusters.
To cleanly remove all resources created from the Kubernetes cluster:
-
Delete Argo CD Application:
- Log in to the Argo CD UI.
- Delete the
web-app
application to remove deployed resources from the cluster.
-
Uninstall Argo CD and Argo Rollouts Controllers:
-
Uninstall Argo CD:
kubectl delete -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
-
Uninstall Argo Rollouts:
kubectl delete -n argo-rollouts -f https://github.com/argoproj/argo-rollouts/releases/latest/download/install.yaml
-
Delete Kubernetes Resources:
- Use
kubectl delete
commands to delete any remaining Kubernetes resources, such as deployments, services, and pods.
- Use
-
Clean Up Git Repository:
- Optionally, clean up the Git repository by removing any files or branches related to it.
By following these steps, we can ensure a clean removal of all resources created, leaving the Kubernetes cluster and Git repository in original state.