Argo AnalysisTemplates: Reusable Health Checks for Deployments
An AnalysisTemplate is a reusable recipe for judging a deployment's health. During a canary rollout, Argo uses it to query metrics like error rates to decide whether to promote or roll back the new version.
Why it exists
Manually checking dashboards during a deployment is slow, error-prone, and doesn't scale. Teams needed a way to codify their release quality gates, automating the decision to promote or roll back a new version based on live system metrics instead of human intervention.
The mental model
An AnalysisTemplate is like a doctor's checklist for a patient (your new application version). It's a reusable, pre-written set of tests to run, like "check temperature" (query latency) or "check blood pressure" (query error rate). The Rollout is the doctor who runs the tests and decides if the patient is healthy enough to be discharged (receive 100% of traffic).
How it works
You define an AnalysisTemplate as a Kubernetes custom resource. Inside, you specify one or more metrics, such as a Prometheus query for HTTP 5xx errors. You set conditions like failureLimit or consecutiveSuccessLimit to define the pass/fail criteria. Your Rollout resource then references this template. When the Rollout reaches an analysis step, it creates an AnalysisRun from the template. The Argo Rollouts controller executes the queries in the AnalysisRun, compares results against the thresholds, and then either promotes, pauses, or aborts the rollout.
When to use it
Use AnalysisTemplates to automate quality gates in any progressive delivery pipeline managed by Argo Rollouts. They are ideal for standardizing release criteria across multiple services. For example, all backend APIs might use a standard "API Health" template that checks error rates and latency. A ClusterAnalysisTemplate can be used to share a single template across all namespaces in a cluster.
When not to use it
Avoid AnalysisTemplates for one-off, highly specific checks that won't be reused; for those, define the analysis inline directly within the Rollout spec. They are not a replacement for a comprehensive observability platform; they are a tool for making automated decisions during a deployment, not for general system monitoring.
One canonical example
A common template checks the 5xx error rate of a canary deployment. The template defines a Prometheus query like sum(rate(http_requests_total{status_code=~"5.."}[1m])). The analysis might run every 30 seconds with a failure condition like result[0] > 0.01. If the error rate ever exceeds 1%, the analysis fails, and the rollout is automatically aborted, preventing a faulty version from being fully promoted.
Interview question
Which scenario best justifies using an Argo AnalysisTemplate over other analysis methods?
- a.Automating a common set of quality gates for multiple services during progressive delivery.Correct
- b.Replacing an existing monitoring system to collect all application metrics.
- c.Providing a human operator with a detailed dashboard for manual promotion decisions.
- d.Implementing a highly specific, non-reusable health check for a single deployment.
Why? this is the answer
AnalysisTemplates are designed for standardizing and reusing release quality gates across multiple services, automating decisions during progressive delivery. They are explicitly not for one-off checks (which use inline analysis) nor for replacing comprehensive observability platforms.
Just read this? Test yourself on what you have been reading.
Read the original → argoproj.github.io
- #ci/cd
- #kubernetes
- #argo
- #progressive delivery
Put your scrolling time to good use
Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Open roles that interview on ci/cd — each one lists the topics its interview covers.
See open roles