This lesson shows how to create an Argo Rollouts AnalysisTemplate — the reusable resource that defines how to perform runtime analysis during progressive delivery. AnalysisTemplates specify which metrics to collect, how often to collect them, how many samples to take, and what constitutes success or failure. They can accept runtime arguments (including secrets) so Rollouts can pass contextual values into the template. Below is a minimal AnalysisTemplate manifest showing the resource kind and metadata:Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
Template arguments (args)
AnalysisTemplates accept args (input parameters) that Rollouts supply at runtime. An arg can be required (no default) or optional (with a default value). Args can also be populated from Kubernetes Secrets usingvalueFrom.secretKeyRef.
Example of args and metrics declared in an AnalysisTemplate:
args namespace, for example {{ args.service-name }}.
Arguments are substituted at runtime using the template expression
{{ args.<name> }}. Ensure the argument names in your Rollout match exactly those declared in the AnalysisTemplate.Metrics, providers, and conditions
The core of an AnalysisTemplate is themetrics list. Each metric declares:
- A name
- A sampling cadence (
interval) - How many samples (
count) or an allowed number of failures (failureLimit) - A
successConditionand optionalfailureConditionto evaluate the provider result - A provider (Prometheus, Datadog, New Relic, Job, Web/HTTP, CloudWatch, etc.)
successCondition and failureCondition receive a result object whose structure depends on the provider (for web, result.code is HTTP status; for Prometheus, result is typically a vector/array).
Common providers at a glance:
| Provider | Use Case | Key result field |
|---|---|---|
| Prometheus | Query metrics and SLI-style checks | result (array/vector, often indexed like result[0]) |
| Web (HTTP) | Call HTTP endpoints (health, readiness, custom API) | result.code, result.body, JSON extraction via jsonPath |
| Job | Run a Kubernetes Job to compute or validate results | Job exit code / logs |
| Datadog / New Relic / CloudWatch | Provider-specific metric queries | Provider-specific result fields |
Prometheus provider example
Prometheus query results are returned in vector form, so you typically index intoresult (for example result[0]) when writing successCondition.
- Use
failureLimitto allow a small number of failing samples before the analysis fails. - Choose
intervalto balance responsiveness with query load.
Web (HTTP) provider example
The web provider performs HTTP requests to gather a measurement. You can configure the URL, HTTP method, headers, timeout, and optional JSON path to extract values from the response body.- Use
jsonPathto extract a specific value from JSON responses; the extracted value becomesresult. timeoutSecondsdefaults to 10s unless overridden.
Example: HTTP health-check AnalysisTemplate
This complete AnalysisTemplate uses the web provider to call a service/health endpoint. It runs 3 probes at 5-second intervals and treats any 2xx HTTP status as success.
count: 3— the probe will be executed three times.interval: 5s— delay between successive probes.successCondition— for the web provider,result.codecontains the HTTP response status code.
Use
count and interval to control sample size and cadence. Collecting multiple samples helps smooth out transient failures and reduces flakiness in progressive rollouts.