Skip to main content
This guide shows how to add a custom health check in Argo CD that validates a ConfigMap and influences the health status of an Argo CD Application. Argo CD includes many built-in health assessments for standard Kubernetes resources, but you can extend these checks by adding small Lua scripts to the Argo CD config (argocd-cm ConfigMap).
A screenshot of the Argo CD documentation web page showing the "Resource Health" section with an overview and checks for Kubernetes resources. The page includes a left navigation menu and a right-side table of contents.

How Argo CD custom health checks work

Custom health checks are Lua snippets stored in the argocd-cm ConfigMap under keys following a naming convention. Argo CD executes these scripts for matching resources and expects a table with at least a status field (e.g., “Healthy”, “Degraded”, “Progressing”) and an optional message. Key naming examples: Example: a Lua health script for the Argo CD Application resource that reads the Application status if present:

Demo application overview

This demo repository contains an application named health-check that demonstrates a ConfigMap-driven scenario:
  • ConfigMap: moving-shapes-colors — defines color values for shapes.
  • Deployment: random-shapes — loads the ConfigMap via envFrom.
  • Service: exposes the application.
Example ConfigMap used by the application (note the TRIANGLE_COLOR intentionally set to “white”, which we use to trigger a Degraded health state):
Deployment that consumes the ConfigMap via envFrom:

Create the Argo CD Application

Create an Argo CD Application that points to the health-check path in the git repo, targets the namespace health-check, and asks Argo CD to create the namespace. If you are not logged in to the argocd server the create command can fail — log in first if necessary. Attempt to create the app (may fail if not logged in):
If it fails due to authentication, log in to Argo CD (example):
Re-run the create command after successful login:
Back in the Argo CD UI you should now see the new application in OutOfSync / Missing state (before sync):
Screenshot of the Argo CD web UI showing the "health-check-app" application marked OutOfSync and Missing. A synchronization panel is open on the right with sync options (Auto-create Namespace checked) and three resources selected for sync.

Sync the application and verify resources

Sync the application. Argo CD will create the namespace, then the ConfigMap, the Service, and finally the Deployment. The pod will initially show states like ContainerCreating / Progressing in the UI:
A screenshot of the Argo CD web UI showing details for the pod "random-shapes-5d55cc76-lc95h" in the health-check namespace. The pod is in state "ContainerCreating" with health "Progressing," and the left sidebar shows application navigation and resource filters.
You can also verify namespace and pod status with kubectl:

Add a custom health check for ConfigMap

In this demo the triangle becomes invisible when TRIANGLE_COLOR is white. We’ll use that condition to mark the application as Degraded by adding a custom health check. Edit the argocd-cm ConfigMap in the argocd namespace and add a Lua snippet under the key resource.customizations.health.ConfigMap. The script below sets Degraded when TRIANGLE_COLOR equals white and returns a helpful message.
Custom health checks are Lua scripts executed by Argo CD. Be careful with Lua equality operators: == tests equality, ~= tests inequality.
Apply the change by editing the ConfigMap:
After saving the ConfigMap, refresh the Application in the Argo CD UI. Because the deployed ConfigMap moving-shapes-colors has TRIANGLE_COLOR set to white, Argo CD will evaluate the health hook and mark the ConfigMap (and the Application) as Degraded with the message you supplied (“Use any color other than white for TRIANGLE_COLOR”).

Resolve the degraded state

To resolve the degraded state, change the TRIANGLE_COLOR value either in the Git repo and sync, or edit the deployed ConfigMap directly and then restart pods if necessary so they pick up the change. Example: edit the deployed ConfigMap in the health-check namespace:
Once the ConfigMap no longer matches the Degraded condition, Argo CD’s custom health check will evaluate to Healthy and the application health will return to Healthy. The Argo CD UI resource tree will then display the ConfigMap, Service, Deployment/pods, and overall application health:
A screenshot of the Argo CD web UI showing the "health-check-app" application with sync and health status panels at the top and a resource tree diagram on the right listing components like moving-shapes-colors, random-shapes-svc, and pods. The left sidebar shows navigation and resource filters.

Summary

  • Add custom health checks by editing argocd-cm and providing Lua scripts under resource.customizations.health.*.
  • Use resource.customizations.health.ConfigMap to apply checks for core ConfigMap resources.
  • Argo CD executes these Lua checks and surfaces any custom status and message in the UI for the resource and its parent Application.

Watch Video