Overview
Argo CD provides built-in health checks for standard Kubernetes resources. For custom resources or specialized health logic, you can write custom health checks in Lua.Built-in Health ChecksArgo CD includes health checks for:
- Deployments, ReplicaSets, StatefulSets, DaemonSets
- Services, Ingresses
- Jobs, CronJobs
- PersistentVolumeClaims
- And more…
When to Use Custom Health Checks
Custom Resources
Add health checks for CRDs that Argo CD doesn’t recognize
Fix Known Issues
Override buggy health checks for resources stuck in Progressing state
Complex Logic
Implement sophisticated health determination based on resource conditions
Domain-Specific
Check health based on your application’s specific requirements
Health Status Values
Custom health checks must return one of these statuses:- Healthy
- Progressing
- Degraded
- Suspended
Resource is healthy and operating normally.
Configuration Methods
Method 1: ConfigMap Configuration
Define health checks in theargocd-cm ConfigMap:
The customization key format is
resource.customizations.health.<apiGroup>_<kind>.Method 2: Contribute Built-in Check
Contribute health checks to the Argo CD repository:1
Create Directory Structure
Follow the structure above in your fork of the Argo CD repository.
2
Write health.lua
Implement your health check logic.
3
Add Tests
Create
health_test.yaml with test cases:4
Run Tests
5
Submit PR
Submit your contribution following the contributing guide.
Writing Health Check Scripts
Basic Example
Condition-Based Check
Multiple Conditions
Wildcard Support
ConfigMap Wildcards
Match multiple resources with wildcards:Wildcards only work with the
resource.customizations key format. The resource.customizations.health.<group>_<kind> format doesn’t support wildcards.Built-in Wildcards
For contributed health checks, use_ as wildcard in directory names:
Advanced Configuration
Enable Standard Lua Libraries
Restore Application Health Check
The health check forargoproj.io/Application was removed in v1.8. Restore it for app-of-apps patterns:
Health Inheritance
The Deployment is healthy even though one ReplicaSet is unhealthy, because health is based only on the Deployment’s own status fields.Application-Level Health
Argo CD Application health is the worst health of its immediate child resources: Priority (most to least healthy): Healthy → Suspended → Progressing → Missing → Degraded → UnknownIgnoring Resource Health
Exclude specific resources from affecting Application health:Overriding Built-in Checks
You can override Go-based built-in health checks with Lua scripts. This is useful for:- Customizing behavior for your environment
- Working around bugs in built-in checks
- Adding more sophisticated logic
- PersistentVolumeClaim, Pod, Service
- APIService, DaemonSet, Deployment, ReplicaSet, StatefulSet
- Workflow (Argo Workflows)
- HorizontalPodAutoscaler
- Job, Ingress
Testing Health Checks
Create comprehensive test coverage:Best Practices
Return Early
Return Early
Return as soon as you determine the status—don’t process unnecessarily.
Provide Meaningful Messages
Provide Meaningful Messages
Include helpful context in the message:
Handle Missing Fields
Handle Missing Fields
Always check if fields exist before accessing:
Default to Progressing
Default to Progressing
When in doubt, return Progressing rather than Healthy:
Example: Crossplane Resource
Next Steps
Resource Actions
Define custom actions for resources
Config Management Plugins
Create custom config management plugins
Example Health Checks
Browse built-in health checks
Lua Documentation
Learn Lua scripting