Managing Applications with ArgoCD
/ 2 min read
Series Navigation
- Part 1: Introduction to ArgoCD
- Part 2: Managing Applications with ArgoCD (Current)
- Part 3: Multi-Cluster Management with ArgoCD
- Part 4: Advanced ArgoCD Patterns
- Part 5: Real-World ArgoCD Case Studies
- Part 6: Multi-Environment Deployments
- Part 7: Environment-Specific Configurations
- Part 8: Comparing Deployment Approaches
Managing Applications with ArgoCD
In this second part of our ArgoCD series, we’ll dive deep into application management, covering everything from creating applications to advanced sync strategies.
Creating Applications
Via CLI
argocd app create guestbook \ --repo https://github.com/argoproj/argocd-example-apps.git \ --path guestbook \ --dest-server https://kubernetes.default.svc \ --dest-namespace defaultVia YAML
apiVersion: argoproj.io/v1alpha1kind: Applicationmetadata: name: guestbook namespace: argocdspec: project: default source: repoURL: https://github.com/argoproj/argocd-example-apps.git targetRevision: HEAD path: guestbook destination: server: https://kubernetes.default.svc namespace: default syncPolicy: automated: prune: true selfHeal: trueSync Strategies
Manual Sync
- Requires explicit approval
- Good for production environments
- Allows review before deployment
Automated Sync
syncPolicy: automated: prune: true # Remove resources that no longer exist in Git selfHeal: true # Revert manual changesHealth Checks
ArgoCD provides built-in health assessments for:
- Kubernetes resources
- Custom resources
- Helm releases
- Custom health checks
Custom Health Checks
apiVersion: argoproj.io/v1alpha1kind: Applicationmetadata: name: myappspec: ignoreDifferences: - group: apps kind: Deployment jsonPointers: - /spec/replicas health: - check: command: ["/scripts/health-check.sh"] args: ["myapp"]Resource Hooks
Pre-sync and post-sync hooks for tasks like:
- Database migrations
- Resource validation
- Notifications
apiVersion: batch/v1kind: Jobmetadata: annotations: argocd.argoproj.io/hook: PreSyncBest Practices
-
Application Structure
- Use Helm charts or Kustomize for templating
- Maintain separate configs for different environments
- Version your manifests
-
Sync Policies
- Use automated sync for dev/staging
- Manual sync for production
- Enable pruning with caution
-
Resource Management
- Set resource limits
- Use namespaces for isolation
- Implement RBAC
Advanced Features
App of Apps Pattern
apiVersion: argoproj.io/v1alpha1kind: Applicationmetadata: name: appsspec: source: path: apps repoURL: https://github.com/org/apps.git destination: namespace: argocd server: https://kubernetes.default.svcSync Windows
apiVersion: argoproj.io/v1alpha1kind: AppProjectmetadata: name: myprojectspec: syncWindows: - kind: allow schedule: "10 1 * * *" duration: 1hMonitoring and Troubleshooting
-
Sync Status
Terminal window argocd app get myappargocd app sync myapp -
Logs
Terminal window argocd app logs myappkubectl logs deployment/argocd-application-controller -n argocd -
Diff
Terminal window argocd app diff myapp
Conclusion
Effective application management in ArgoCD requires understanding:
- Application creation and configuration
- Sync strategies and policies
- Health checks and monitoring
- Resource hooks and advanced patterns
In the next part, we’ll explore advanced topics including:
- Multi-cluster management
- SSO integration
- Custom resource management
- Notification systems