Create an AnalysisTemplate resource with spec.metrics listing one or more metric definitions; each metric has a name, provider block, and success/failure conditions.
Under provider, add a prometheus block with address pointing to your Prometheus server URL and a query field containing a valid PromQL expression that returns a scalar or instant vector.
Set successCondition using Go template syntax (e.g., result[0] >= 0.95) and optionally failureCondition; set failureLimit to the number of consecutive failures before the analysis is marked failed.
Validate your PromQL expression in the Prometheus UI before embedding it in the template; Prometheus queries returning an empty vector require result handling in the condition (e.g., len(result) == 0 || result[0] >= 0.95).
Reference the AnalysisTemplate from a Rollout via spec.strategy.canary.analysis.templates or inline in a canary step using an analysis field.
Use kubectl argo rollouts get rollout <name> to observe AnalysisRun status and inspect individual metric results during a canary or blue-green promotion.
Known gotchas
Prometheus queries in AnalysisTemplates return instant vectors; the successCondition must index into the result array (e.g., result[0]) because the condition evaluator receives a slice, not a scalar.
If the Prometheus server is not reachable from the Argo Rollouts controller, the AnalysisRun enters an Error state (not a Fail state), which by default does not abort the rollout; configure the inconclusiveLimit to treat repeated errors as failures.
AnalysisTemplates are namespace-scoped; a Rollout in namespace A cannot directly reference an AnalysisTemplate in namespace B—copy or replicate the template into the same namespace.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp