This is the documentation for the latest development version of Velero. Both code and docs may be unstable, and these docs are not guaranteed to be up to date or correct. See the latest version.
When using --include-namespaces and --exclude-namespaces flags with backup and restore commands, you can use glob patterns to match multiple namespaces.
Velero supports the following glob pattern characters:
* - Matches any sequence of characters
velero backup create my-backup --include-namespaces "app-*"
# Matches: app-prod, app-staging, app-dev, etc.
? - Matches exactly one character
velero backup create my-backup --include-namespaces "ns?"
# Matches: ns1, ns2, nsa, but NOT ns10
[abc] - Matches any single character in the brackets
velero backup create my-backup --include-namespaces "ns[123]"
# Matches: ns1, ns2, ns3
[a-z] - Matches any single character in the range
velero backup create my-backup --include-namespaces "ns[a-c]"
# Matches: nsa, nsb, nsc
The following patterns are not supported and will cause validation errors:
** - Consecutive asterisks| - Alternation (regex operator)() - Grouping (regex operators)! - Negation{} - Brace expansion, - Comma (used in brace expansion)* alone means “all namespaces” and is not expanded[] are invalidCombine patterns with include and exclude flags:
# Backup all production namespaces except test
velero backup create prod-backup \
--include-namespaces "*-prod" \
--exclude-namespaces "test-*"
# Backup specific numbered namespaces
velero backup create numbered-backup \
--include-namespaces "app-[0-9]"
# Restore namespaces matching multiple patterns
velero restore create my-restore \
--from-backup my-backup \
--include-namespaces "frontend-*,backend-*"
To help you get started, see the documentation.