diff --git a/site/_data/main-toc.yml b/site/_data/main-toc.yml index d01f1bc40..c4adfa523 100644 --- a/site/_data/main-toc.yml +++ b/site/_data/main-toc.yml @@ -31,6 +31,8 @@ toc: url: /disaster-case - page: Cluster migration url: /migration-case + - page: Resource filtering + url: /resource-filtering - page: Backup reference url: /backup-reference - page: Restore reference diff --git a/site/_data/v1-4-toc.yml b/site/_data/v1-4-toc.yml index 0643116c8..9c693c583 100644 --- a/site/_data/v1-4-toc.yml +++ b/site/_data/v1-4-toc.yml @@ -31,6 +31,8 @@ toc: url: /disaster-case - page: Cluster migration url: /migration-case + - page: Resource filtering + url: /resource-filtering - page: Backup reference url: /backup-reference - page: Restore reference diff --git a/site/docs/main/resource-filtering.md b/site/docs/main/resource-filtering.md new file mode 100644 index 000000000..15e513819 --- /dev/null +++ b/site/docs/main/resource-filtering.md @@ -0,0 +1,129 @@ +# Resource Filtering + +*Filter objects by namespace, type, or labels.* + +Velero includes all objects in a backup or restore when no filtering options are used. + +## Includes + +Only specific resources are included, excluding all others. + +Wildcard takes precedence when both a wildcard and specific resource are included. + +### --include-namespaces + +* Backup a namespace and it's objects. + + ```bash + velero backup create --include-namespaces + ``` + +* Restore two namespaces and their objects. + + ```bash + velero restore create --include-namespaces , + ``` + +### --include-resources + +* Backup all deployments in the cluster. + + ```bash + velero backup create --include-resources deployments + ``` + +* Restore all deployments and configmaps in the cluster. + + ```bash + velero restore create --include-resources deployments,configmaps + ``` + +* Backup the deployments in a namespace. + + ```bash + velero backup create --include-resources deployments --include-namespaces + ``` + +### --include-cluster-resources + + This option can have three possible values: + +* `true`: all cluster-scoped resources are included. + +* `false`: no cluster-scoped resources are included. + +* `nil` ("auto" or not supplied): + + - Cluster-scoped resources are included when backing up or restoring all namespaces. Default: `true`. + + - Cluster-scoped resources are not included when namespace filtering is used. Default: `false`. + + * Some related cluster-scoped resources may still be backed/restored up if triggered by a custom action (for example, PVC->PV) unless `--include-cluster-resources=false`. + +* Backup entire cluster including cluster-scoped resources. + + ```bash + velero backup create + ``` + +* Restore only namespaced resources in the cluster. + + ```bash + velero restore create --include-cluster-resources=false + ``` + +* Backup a namespace and include cluster-scoped resources. + + ```bash + velero backup create --include-namespaces --include-cluster-resources=true + ``` + +### --selector + +* Include resources matching the label selector. + + ```bash + velero backup create --selector = + ``` + + +## Excludes + +Exclude specific resources from the backup. + +Wildcard excludes are ignored. + +### --exclude-namespaces + +* Exclude kube-system from the cluster backup. + + ```bash + velero backup create --exclude-namespaces kube-system + ``` + +* Exclude two namespaces during a restore. + + ```bash + velero restore create --exclude-namespaces , + ``` + +### --exclude-resources + +* Exclude secrets from the backup. + + ```bash + velero backup create --exclude-resources secrets + ``` + +* Exclude secrets and rolebindings. + + ```bash + velero backup create --exclude-resources secrets,rolebindings + ``` + +### velero.io/exclude-from-backup=true + +* Resources with the label `velero.io/exclude-from-backup=true` are not included in backup, even if it contains a matching selector label. + + + diff --git a/site/docs/v1.4/resource-filtering.md b/site/docs/v1.4/resource-filtering.md new file mode 100644 index 000000000..15e513819 --- /dev/null +++ b/site/docs/v1.4/resource-filtering.md @@ -0,0 +1,129 @@ +# Resource Filtering + +*Filter objects by namespace, type, or labels.* + +Velero includes all objects in a backup or restore when no filtering options are used. + +## Includes + +Only specific resources are included, excluding all others. + +Wildcard takes precedence when both a wildcard and specific resource are included. + +### --include-namespaces + +* Backup a namespace and it's objects. + + ```bash + velero backup create --include-namespaces + ``` + +* Restore two namespaces and their objects. + + ```bash + velero restore create --include-namespaces , + ``` + +### --include-resources + +* Backup all deployments in the cluster. + + ```bash + velero backup create --include-resources deployments + ``` + +* Restore all deployments and configmaps in the cluster. + + ```bash + velero restore create --include-resources deployments,configmaps + ``` + +* Backup the deployments in a namespace. + + ```bash + velero backup create --include-resources deployments --include-namespaces + ``` + +### --include-cluster-resources + + This option can have three possible values: + +* `true`: all cluster-scoped resources are included. + +* `false`: no cluster-scoped resources are included. + +* `nil` ("auto" or not supplied): + + - Cluster-scoped resources are included when backing up or restoring all namespaces. Default: `true`. + + - Cluster-scoped resources are not included when namespace filtering is used. Default: `false`. + + * Some related cluster-scoped resources may still be backed/restored up if triggered by a custom action (for example, PVC->PV) unless `--include-cluster-resources=false`. + +* Backup entire cluster including cluster-scoped resources. + + ```bash + velero backup create + ``` + +* Restore only namespaced resources in the cluster. + + ```bash + velero restore create --include-cluster-resources=false + ``` + +* Backup a namespace and include cluster-scoped resources. + + ```bash + velero backup create --include-namespaces --include-cluster-resources=true + ``` + +### --selector + +* Include resources matching the label selector. + + ```bash + velero backup create --selector = + ``` + + +## Excludes + +Exclude specific resources from the backup. + +Wildcard excludes are ignored. + +### --exclude-namespaces + +* Exclude kube-system from the cluster backup. + + ```bash + velero backup create --exclude-namespaces kube-system + ``` + +* Exclude two namespaces during a restore. + + ```bash + velero restore create --exclude-namespaces , + ``` + +### --exclude-resources + +* Exclude secrets from the backup. + + ```bash + velero backup create --exclude-resources secrets + ``` + +* Exclude secrets and rolebindings. + + ```bash + velero backup create --exclude-resources secrets,rolebindings + ``` + +### velero.io/exclude-from-backup=true + +* Resources with the label `velero.io/exclude-from-backup=true` are not included in backup, even if it contains a matching selector label. + + +