This project demonstrates the implementation of GitOps using ArgoCD for managing Kubernetes deployments. GitOps ensures that the desired state of a Kubernetes cluster is maintained using version-controlled configurations.
- Declarative Infrastructure : Manage Kubernetes manifests via Git.
- Continuous Deployment : Automatically sync application states.
- Single cluster Management : Deploy and monitor application across single clusters.
- Automated Syncing : Ensure applications stay in their desired state without manual intervention.
- Kubernetes Cluster (Minikube, EKS, GKE, AKS, etc.)
- ArgoCD installed and configured
- Git repository with Kubernetes manifests
- kubectl installed
- argocd CLI installed
- Docker installed (if building container images)
https://minikube.sigs.k8s.io/docs/start/?arch=%2Fmacos%2Farm64%2Fstable%2Fbinary+download
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yamlkubectl get pods -n argocdEnsure all pods are in Running state:
NAME READY STATUS RESTARTS AGE
argocd-server-7f7b6dbd9b-xxxxx 1/1 Running 0 2m
argocd-repo-server-xxxx 1/1 Running 0 2m
argocd-dex-server-xxxxx 1/1 Running 0 2m
argocd-redis-xxxxx 1/1 Running 0 2m
kubectl port-forward svc/argocd-server -n argocd 8080:443Now, access https://localhost:8080 in your browser.
Retrieve the external IP and access ArgoCD via https://<EXTERNAL-IP>.
Apply an ingress resource pointing to the ArgoCD service.
kubectl get secret -n argocd argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -dUse this password to log in to the UI or CLI.
argocd login <ARGOCD-SERVER> --username admin --password <retrieved-password>argocd repo add <your-git-repo-url>Ensure your repository contains Kubernetes manifests or Helm charts.
argocd app create my-app \
--repo <your-git-repo-url> \
--path <k8s-manifest-path> \
--dest-server https://kubernetes.default.svc \
--dest-namespace defaultargocd app sync my-app
argocd app get my-appCheck the status of the application:
argocd app listEnable auto-syncing to ensure ArgoCD automatically applies any changes in the Git repository:
argocd app set my-app --sync-policy automatedEnable pruning and self-healing to remove outdated resources:
argocd app set my-app --sync-policy automated --auto-prune --self-healOnce deployed, retrieve the service information:
kubectl get svc -n ArgoaCDIf using port-forwarding:
kubectl port-forward svc/my-node-service 9000:80 -n argocd- Keep application configurations in a separate Git repository.
- Set up automated sync policies for self-healing.
- Monitor application state with ArgoCD dashboards.
kubectl logs -n argocd -l app.kubernetes.io/name=argocd-serverkubectl rollout restart deployment argocd-server -n argocdargocd app sync my-app --forceargocd app history my-app
argocd app diff my-appSapna Kamble Syeda Maseera Tabassum