A simple project to learn ArgoCD GitOps with a frontend webserver and backend API.
argo/
├── argocd/ # ArgoCD Application manifests
│ ├── app-of-apps.yaml # Parent app that manages other apps
│ ├── application-backend.yaml
│ ├── application-frontend.yaml
│ ├── namespace.yaml
│ └── project.yaml # ArgoCD Project definition
├── base/
│ ├── backend/ # Backend API (http-echo)
│ │ ├── deployment.yaml
│ │ ├── service.yaml
│ │ └── kustomization.yaml
│ └── frontend/ # Frontend webserver (nginx)
│ ├── configmap.yaml
│ ├── deployment.yaml
│ ├── service.yaml
│ └── kustomization.yaml
└── README.md
- Kubernetes cluster (minikube, kind, k3s, etc.)
- kubectl configured
- ArgoCD installed in your cluster
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml# Get the initial admin password
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d
# Port forward to access the UI
kubectl port-forward svc/argocd-server -n argocd 8080:443Then open https://localhost:8080 (username: admin)
git init
git add .
git commit -m "Initial ArgoCD demo project"
git remote add origin https://github.com/YOUR_USERNAME/argo.git
git push -u origin mainEdit these files and replace YOUR_USERNAME with your GitHub username:
argocd/application-backend.yamlargocd/application-frontend.yamlargocd/app-of-apps.yaml
kubectl apply -f argocd/app-of-apps.yamlOr deploy apps individually:
kubectl apply -f argocd/namespace.yaml
kubectl apply -f argocd/project.yaml
kubectl apply -f argocd/application-backend.yaml
kubectl apply -f argocd/application-frontend.yaml# If using minikube
minikube service frontend -n demo-app
# Or port-forward
kubectl port-forward svc/frontend -n demo-app 8081:80- Disable auto-sync in the ArgoCD UI
- Change
replicas: 2toreplicas: 3inbase/backend/deployment.yaml - Push the change to git
- Watch ArgoCD detect the change (OutOfSync status)
- Click "Sync" to apply the change
- Manually scale the backend:
kubectl scale deployment backend -n demo-app --replicas=1 - Watch ArgoCD automatically restore to the desired state (2 replicas)
- Make a change to the frontend ConfigMap
- Push to git and let it sync
- Use ArgoCD UI to rollback to a previous version
- Create a new directory
base/redis/ - Add Redis deployment manifests
- Create
argocd/application-redis.yaml - Push and watch ArgoCD deploy it automatically
| Concept | Description |
|---|---|
| Application | A group of Kubernetes resources defined in a Git repo |
| Project | A logical grouping of Applications with access controls |
| Sync | Process of applying Git manifests to the cluster |
| Self-Heal | Automatically revert manual changes to match Git |
| Prune | Delete resources removed from Git |
| App of Apps | Pattern where one Application manages other Applications |
# ArgoCD CLI (install: brew install argocd)
argocd login localhost:8080
argocd app list
argocd app get frontend
argocd app sync frontend
argocd app history frontend
argocd app rollback frontend <revision>
# Kubectl
kubectl get applications -n argocd
kubectl get all -n demo-appApp stuck in "Progressing":
kubectl describe application frontend -n argocd
kubectl get events -n demo-appSync failed:
- Check the ArgoCD UI for detailed error messages
- Verify the Git repo URL and branch are correct
- Ensure the path to manifests exists