Roll back a workload
Roll a Deployment, StatefulSet or DaemonSet back to its previous revision, or to a revision you name, and wait until the old pods are ready again.
Install v1.0.0
Installs the template into your Argo namespace. The URL is pinned to this version.
kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/kubectl-rollout-undo/1.0.0/template.yaml
Or with the Argo CLI:
argo template create -n argo https://catalog.dagweave.com/api/v1/items/kubectl-rollout-undo/1.0.0/template.yaml
Facts
- Category
- Kubernetes
- Tags
- kubectl kubernetes
- Entrypoint
undo- Template SHA-256
890e2e338ce5d6c79dc1853ec502c9d44556278c4fcf6f3019b7f90797ca65ff- Source
- kubectl-rollout-undo at catalog commit 67458f7
- API
- item document, latest template.yaml
Images and provenance
Every image is pinned by digest, so a rebuilt tag can never change what this version runs.
| Repository | Tag | Digest |
|---|---|---|
cgr.dev/chainguard/kubectl | latest-dev | sha256:98f9c337808ecf5d5e80b79af4345762a3d8c803ebf8c857d2dddabf885107ba |
Parameters
| Name | Description | Default |
|---|---|---|
name required |
Name of the workload. Example checkout-api |
none |
kind |
Kind of workload to roll back. One of deployment, statefulset, daemonset |
deployment |
namespace |
Namespace the resource lives in. Example default |
default |
timeout |
Longest time to wait for the rollback to finish, such as 300s or 5m. | 300s |
to-revision |
Revision number to return to. Leave blank to go back one revision. Example 4 |
empty |
WorkflowTemplate
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: kubectl-rollout-undo
labels:
dagweave.io/catalog-item: kubectl-rollout-undo
annotations:
dagweave.io/catalog-version: "1.0.0"
dagweave.io/catalog-category: "Kubernetes"
spec:
entrypoint: undo
templates:
- name: undo
metadata:
annotations:
dagweave.io/local-support: unsupported
dagweave.io/local-support-reason: >-
This step runs kubectl with whatever identity the pod is given. On Dagweave
Local that is the default service account of the hidden cluster's argo
namespace, which Argo's quick-start install grants create, get and patch on pods
and create and get on workflows, and nothing anywhere else. The rollback patches
a workload in the apps group, which that account cannot touch, so the step fails
on a 403 rather than touching anything. The cluster you meant is one this run
cannot reach.
inputs:
parameters:
- name: kind
default: "deployment"
- name: name
- name: namespace
default: "default"
- name: to-revision
default: ""
- name: timeout
default: "300s"
retryStrategy:
limit: "2"
retryPolicy: OnError
backoff:
duration: 10s
factor: "2"
maxDuration: 2m
container:
# cgr.dev/chainguard/kubectl:latest-dev
image: cgr.dev/chainguard/kubectl@sha256:98f9c337808ecf5d5e80b79af4345762a3d8c803ebf8c857d2dddabf885107ba
command: [sh, -c]
args:
- |
set -eu
set -- "${KIND}/${NAME}" -n "${NAMESPACE}"
if [ -n "${TO_REVISION}" ]; then set -- "$@" --to-revision="${TO_REVISION}"; fi
kubectl rollout undo "$@"
kubectl rollout status "${KIND}/${NAME}" -n "${NAMESPACE}" --timeout="${TIMEOUT}"
env:
- name: KIND
value: "{{inputs.parameters.kind}}"
- name: NAME
value: "{{inputs.parameters.name}}"
- name: NAMESPACE
value: "{{inputs.parameters.namespace}}"
- name: TO_REVISION
value: "{{inputs.parameters.to-revision}}"
- name: TIMEOUT
value: "{{inputs.parameters.timeout}}"
resources:
requests:
cpu: 50m
memory: 64Mi
limits:
memory: 256Mi
Version history
Read from the item's changelog. Each version has its own JSON document; the pinned catalogue vendors the manifest of the latest one, so that is the version that installs.
-
1.0.0 latest 2026-10-18
Initial release.
kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/kubectl-rollout-undo/1.0.0/template.yamlargo template create -n argo https://catalog.dagweave.com/api/v1/items/kubectl-rollout-undo/1.0.0/template.yaml
Run it once
After installing, from the command line.
argo submit -n argo --from workflowtemplate/kubectl-rollout-undo \
-p name=checkout-api
Workflow that references it
A Workflow with the required parameters filled from the examples.
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: kubectl-rollout-undo-
spec:
workflowTemplateRef:
name: kubectl-rollout-undo
arguments:
parameters:
- name: name
value: "checkout-api"
As a step of a larger workflow
steps:
- - name: kubectl-rollout-undo
templateRef:
name: kubectl-rollout-undo
template: undo