Back up a cluster with Velero
Ask Velero to back up some or all namespaces, wait for the backup to finish, and fail the step unless it completes cleanly. Passes the backup name to later steps.
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/velero-backup/1.0.0/template.yaml
Or with the Argo CLI:
argo template create -n argo https://catalog.dagweave.com/api/v1/items/velero-backup/1.0.0/template.yaml
Facts
- Category
- Kubernetes
- Tags
- kubectl kubernetes
- Entrypoint
backup- Template SHA-256
9adb0dc52431a522118596a4d55ebd0a5866687a7743860f43a58d2a46fe8d9a- Source
- velero-backup 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-prefix |
Prefix for the backup name. Kubernetes adds a random suffix. | backup |
namespaces |
Comma-separated namespaces to back up. Leave blank to back up all of them. Example checkout,payments |
empty |
storage-location |
Name of the Velero backup storage location. Leave blank for the default one. | empty |
timeout-seconds |
Seconds to wait for the backup to finish before failing the step. | 1800 |
ttl |
How long Velero keeps the backup before deleting it. | 720h0m0s |
velero-namespace |
Namespace Velero is installed in. | velero |
WorkflowTemplate
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: velero-backup
labels:
dagweave.io/catalog-item: velero-backup
annotations:
dagweave.io/catalog-version: "1.0.0"
dagweave.io/catalog-category: "Kubernetes"
spec:
entrypoint: backup
templates:
- name: backup
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. Creating a Velero
Backup is outside what that account may do, so the step fails on a 403 rather
than touching anything. The cluster you meant is one this run cannot reach.
inputs:
parameters:
- name: namespaces
default: ""
- name: ttl
default: "720h0m0s"
- name: storage-location
default: ""
- name: velero-namespace
default: "velero"
- name: name-prefix
default: "backup"
- name: timeout-seconds
default: "1800"
outputs:
parameters:
# Name of the Velero Backup object that was created.
- name: backup-name
valueFrom:
path: /tmp/backup-name
container:
# cgr.dev/chainguard/kubectl:latest-dev
image: cgr.dev/chainguard/kubectl@sha256:98f9c337808ecf5d5e80b79af4345762a3d8c803ebf8c857d2dddabf885107ba
command: [sh, -c]
args:
- |
set -eu
case "${INCLUDED_NAMESPACES}${TTL}${STORAGE_LOCATION}${NAME_PREFIX}" in
*[!A-Za-z0-9,._-]*) echo "namespaces, ttl, storage-location and name-prefix take letters, digits and , . _ - only" >&2; exit 2 ;;
esac
backup=$(
{
echo "apiVersion: velero.io/v1"
echo "kind: Backup"
echo "metadata:"
echo " generateName: ${NAME_PREFIX}-"
echo "spec:"
echo " ttl: ${TTL}"
if [ -n "${STORAGE_LOCATION}" ]; then echo " storageLocation: ${STORAGE_LOCATION}"; fi
if [ -n "${INCLUDED_NAMESPACES}" ]; then
echo " includedNamespaces:"
IFS=,
for ns in ${INCLUDED_NAMESPACES}; do echo " - ${ns}"; done
fi
} | kubectl create -n "${VELERO_NAMESPACE}" -f - -o jsonpath='{.metadata.name}'
)
echo "${backup}" > /tmp/backup-name
echo "created backup ${backup}"
end=$(( $(date +%s) + TIMEOUT_SECONDS ))
phase=""
while [ "$(date +%s)" -lt "${end}" ]; do
phase=$(kubectl get backup "${backup}" -n "${VELERO_NAMESPACE}" -o jsonpath='{.status.phase}')
case "${phase}" in
Completed|PartiallyFailed|Failed|FailedValidation) break ;;
esac
sleep 10
done
echo "backup ${backup}: ${phase:-no status yet}"
[ "${phase}" = "Completed" ]
env:
- name: INCLUDED_NAMESPACES
value: "{{inputs.parameters.namespaces}}"
- name: TTL
value: "{{inputs.parameters.ttl}}"
- name: STORAGE_LOCATION
value: "{{inputs.parameters.storage-location}}"
- name: VELERO_NAMESPACE
value: "{{inputs.parameters.velero-namespace}}"
- name: NAME_PREFIX
value: "{{inputs.parameters.name-prefix}}"
- name: TIMEOUT_SECONDS
value: "{{inputs.parameters.timeout-seconds}}"
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/velero-backup/1.0.0/template.yamlargo template create -n argo https://catalog.dagweave.com/api/v1/items/velero-backup/1.0.0/template.yaml
Run it once
After installing, from the command line.
argo submit -n argo --from workflowtemplate/velero-backup
Workflow that references it
A Workflow with the required parameters filled from the examples.
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: velero-backup-
spec:
workflowTemplateRef:
name: velero-backup
As a step of a larger workflow
steps:
- - name: velero-backup
templateRef:
name: velero-backup
template: backup