Configure how Argo CD assesses the health status of your application resources
Argo CD continuously monitors the health of application resources and surfaces their status in the UI and CLI. Understanding health checks is crucial for ensuring your applications are truly ready.
Argo CD provides built-in health assessments for standard Kubernetes resources and allows custom health checks for CRDs and special cases.Application health is determined by the worst health of its immediate child resources:
Add custom health checks to the argocd-cm ConfigMap:
apiVersion: v1kind: ConfigMapmetadata: name: argocd-cm namespace: argocddata: resource.customizations.health.cert-manager.io_Certificate: | hs = {} if obj.status ~= nil then if obj.status.conditions ~= nil then for i, condition in ipairs(obj.status.conditions) do if condition.type == "Ready" and condition.status == "False" then hs.status = "Degraded" hs.message = condition.message return hs end if condition.type == "Ready" and condition.status == "True" then hs.status = "Healthy" hs.message = condition.message return hs end end end end hs.status = "Progressing" hs.message = "Waiting for certificate" return hs
Apply a single health check to multiple resources:
apiVersion: v1kind: ConfigMapmetadata: name: argocd-cm namespace: argocddata: resource.customizations: | ec2.aws.crossplane.io/*: health.lua: | hs = {} if obj.status ~= nil then if obj.status.conditions ~= nil then for i, condition in ipairs(obj.status.conditions) do if condition.type == "Ready" then if condition.status == "True" then hs.status = "Healthy" hs.message = "Resource is ready" else hs.status = "Progressing" hs.message = condition.message or "Resource is not ready" end return hs end end end end hs.status = "Progressing" hs.message = "Waiting for status" return hs
Wildcard patterns only work with the resource.customizations key format, not resource.customizations.health.<group>_<kind>.
data: resource.customizations: | "*.aws.crossplane.io/*": health.lua: | hs = {} if obj.status ~= nil and obj.status.conditions ~= nil then for i, condition in ipairs(obj.status.conditions) do if condition.type == "Ready" then if condition.status == "True" then hs.status = "Healthy" else hs.status = "Degraded" end hs.message = condition.reason or "" return hs end end end hs.status = "Progressing" hs.message = "Provisioning resource" return hs
hs = {}if obj.status ~= nil then if obj.status.conditions ~= nil then for i, condition in ipairs(obj.status.conditions) do if condition.type == "Ready" and condition.status == "True" then hs.status = "Healthy" hs.message = condition.message return hs end end endendhs.status = "Progressing"hs.message = "Waiting for certificate"return hs
health_test.yaml:
tests:- healthStatus: status: Healthy message: Certificate is ready inputPath: testdata/healthy.yaml- healthStatus: status: Progressing message: Waiting for certificate inputPath: testdata/degraded.yaml
Argo CD removed the built-in health check for argoproj.io/Application in v1.8. Restore it for App-of-Apps patterns:
apiVersion: v1kind: ConfigMapmetadata: name: argocd-cm namespace: argocddata: resource.customizations.health.argoproj.io_Application: | hs = {} hs.status = "Progressing" hs.message = "" if obj.status ~= nil then if obj.status.health ~= nil then hs.status = obj.status.health.status if obj.status.health.message ~= nil then hs.message = obj.status.health.message end end end return hs
data: resource.customizations.health.kafka.strimzi.io_KafkaTopic: | hs = {} if obj.status ~= nil and obj.status.conditions ~= nil then for i, condition in ipairs(obj.status.conditions) do if condition.type == "Ready" then if condition.status == "True" then hs.status = "Healthy" hs.message = "Topic is ready" else hs.status = "Degraded" hs.message = condition.message or "Topic is not ready" end return hs end end end hs.status = "Progressing" hs.message = "Waiting for topic to be ready" return hs
data: resource.customizations.health.bitnami.com_SealedSecret: | hs = {} if obj.status ~= nil then if obj.status.conditions ~= nil then for i, condition in ipairs(obj.status.conditions) do if condition.type == "Synced" and condition.status == "True" then hs.status = "Healthy" hs.message = "SealedSecret synced successfully" return hs elseif condition.type == "Synced" and condition.status == "False" then hs.status = "Degraded" hs.message = condition.message or "Failed to sync SealedSecret" return hs end end end end hs.status = "Progressing" hs.message = "Waiting for SealedSecret to sync" return hs
data: resource.customizations.health.external-secrets.io_ExternalSecret: | hs = {} if obj.status ~= nil then if obj.status.conditions ~= nil then for i, condition in ipairs(obj.status.conditions) do if condition.type == "Ready" and condition.status == "True" then hs.status = "Healthy" hs.message = "ExternalSecret is ready" return hs elseif condition.type == "Ready" and condition.status == "False" then hs.status = "Degraded" hs.message = condition.message return hs end end end end hs.status = "Progressing" hs.message = "Waiting for ExternalSecret" return hs
# Install Argo CD locallygit clone https://github.com/argoproj/argo-cd.gitcd argo-cd# Add your health checkmkdir -p resource_customizations/mygroup.io/MyKindcat > resource_customizations/mygroup.io/MyKind/health.lua <<EOFhs = {}-- your health check logicreturn hsEOF# Run testsgo test -v ./util/lua/