opened
hmz
username_0
**Describe the problem/challenge you have**
I wonder if there is a better way to backup only PVs and PVCs in a k8s cluster. My script seems too long.

`velero backup create my-backup --include-resources pvcs,pvs --exclude-resources='pods,services,ServiceAccount,ControllerRevision,StatefulSet,HorizontalPodAutoscaler,Ingress.extensions,Ingress.networking.k8s.io,Endpoints,Event,Event.events.k8s.io,Namespace,Secret,ServiceAccount,deployments.apps,replicasets.apps,deployments.extensions,replicasets.extensions' --include-namespaces my-namespace`


**Describe the solution you'd like**
There should be a shorter version.

**Environment:**

- Velero version : 
Client:
	Version: v1.2.0
	Git commit: -
Server:
	Version: v1.2.0
- Kubernetes version :
Client Version: v1.15.3
Server Version: v1.15.5
- Cloud provider or hardware configuration:
Azure - AKS
How to backup only PVs and PVCs in a k8s cluster
issue
created
skriss
username_1
@username_0 you don't need to specify the `--exclude-resources` flag, since if you're explicitly specifying some resources to be included, only those resources will be included. So, the following should work fine:

```
velero backup create my-backup --include-resources pvcs,pvs --include-namespaces my-namespace`
```

Give that a try and let us know if you have any issues!
comment
created
hmz
username_0
@username_1 Tried, it didn't work;

```
velero backup create my-backup --include-resources pvcs,pvs --include-namespaces account

velero describe backup my-backup --details                                                                                                   
Name:         my-backup
Namespace:    velero
Labels:       velero.io/backup=my-backup
              velero.io/pv=pvc-29ee4f7c-1b4a-11ea-83a0-22ced17d4a3d
              velero.io/storage-location=default
Annotations:  <none>

Phase:  Completed

Namespaces:
  Included:  account
  Excluded:  <none>

Resources:
  Included:        pvcs, pvs
  Excluded:        <none>
  Cluster-scoped:  auto

Label selector:  <none>

Storage Location:  default

Snapshot PVs:  auto

TTL:  720h0m0s

Hooks:  <none>

Backup Format Version:  1

Started:    2020-01-06 19:25:39 +0300 +03
Completed:  2020-01-06 19:25:52 +0300 +03

Expiration:  2020-02-05 19:25:39 +0300 +03

Resource List:
  apps/v1/ControllerRevision:
    - account/account-mssql-statefulset-68d9f4867f
  apps/v1/Deployment:
    - account/account-msc-service-deployment
  apps/v1/ReplicaSet:
    - account/account-msc-service-deployment-55ccb878d5
    - account/account-msc-service-deployment-58cf57d5c9
    - account/account-msc-service-deployment-5b9b9dcfb9
    - account/account-msc-service-deployment-5b9c677989
    - account/account-msc-service-deployment-6484788cd9
    - account/account-msc-service-deployment-65fcfdc796
    - account/account-msc-service-deployment-68cc97fb8f
    - account/account-msc-service-deployment-6989f8d5bf
    - account/account-msc-service-deployment-7fd8c74ff5
    - account/account-msc-service-deployment-c6f648975
    - account/account-msc-service-deployment-f97b87b47
  apps/v1/StatefulSet:
    - account/account-mssql-statefulset
  autoscaling/v1/HorizontalPodAutoscaler:
    - account/account-msc-hpa
  extensions/v1beta1/Ingress:
    - account/account-msc
  networking.k8s.io/v1beta1/Ingress:
    - account/account-msc
  v1/Endpoints:
    - account/account-msc-api-service
    - account/account-mssql-service
  v1/Namespace:
    - account
  v1/PersistentVolume:
    - pvc-29ee4f7c-1b4a-11ea-83a0-22ced17d4a3d
  v1/PersistentVolumeClaim:
    - account/account-mssql-data-pvc
  v1/Pod:
    - account/account-msc-service-deployment-68cc97fb8f-k9bc8
    - account/account-msc-service-deployment-68cc97fb8f-zlft2
    - account/account-mssql-statefulset-0
  v1/Secret:
    - account/default-token-hb8rb
  v1/Service:
    - account/account-msc-api-service
    - account/account-mssql-service
  v1/ServiceAccount:
    - account/default

Persistent Volumes:
  pvc-29ee4f7c-1b4a-11ea-83a0-22ced17d4a3d:
    Snapshot ID:        /subscriptions/*************/resourceGroups/*****************/providers/Microsoft.Compute/snapshots/kubernetes-dynamic-pvc-29ee4f7c-1b4a-11ea-8-1bab3c88-2f8f-4ee9-99a2-c64853e809ce
    Type:               Standard_LRS
    Availability Zone:
    IOPS:               <N/A>

```
comment
created
skriss
username_1
Ah - the pluralized short names "pvcs" and "pvs" aren't actually valid - try this:

```
velero backup create my-backup --include-resources pvc,pv --include-namespaces account
```
comment
created
hmz
username_0
@username_1 that worked thanks:

```
Resource List:
  v1/PersistentVolume:
    - pvc-29ee4f7c-1b4a-11ea-83a0-22ced17d4a3d
  v1/PersistentVolumeClaim:
    - account/account-mssql-data-pvc

```
comment
closed
hmz
username_0
issue
created
arianitu
username_2
I'm having trouble understanding --exclude-resources as well.  Does IncludeNamespace override ExcludeResource? In the below, I exclude Secret and Ingress but it's always included.

```
Name:         b52c2ac1-1116-4618-aa21-547c034c4924
Namespace:    velero
Labels:       velero.io/storage-location=default
Annotations:  <none>

Phase:  Completed

Namespaces:
  Included:  163a252f-dade-45e6-84f7-e7ce970db7d7
  Excluded:  <none>

Resources:
  Included:        *
  Excluded:        Ingress.networking.k8s.io,Ingress.extensions,Secret
  Cluster-scoped:  auto

Label selector:  <none>

Storage Location:  default

Snapshot PVs:  true

TTL:  2h0m0s

Hooks:  <none>

Backup Format Version:  1

Started:    2020-05-04 13:35:39 -0400 EDT
Completed:  2020-05-04 13:36:01 -0400 EDT

Expiration:  2020-05-04 15:35:39 -0400 EDT

Resource List:
  apps/v1/ControllerRevision:
    - 163a252f-dade-45e6-84f7-e7ce970db7d7/mysql-698c89ccd6
  apps/v1/Deployment:
    - 163a252f-dade-45e6-84f7-e7ce970db7d7/app
  apps/v1/ReplicaSet:
    - 163a252f-dade-45e6-84f7-e7ce970db7d7/app-56c96497d7
    - 163a252f-dade-45e6-84f7-e7ce970db7d7/app-77575776b6
  apps/v1/StatefulSet:
    - 163a252f-dade-45e6-84f7-e7ce970db7d7/mysql
  extensions/v1beta1/Ingress:
    - 163a252f-dade-45e6-84f7-e7ce970db7d7/app
  networking.k8s.io/v1/NetworkPolicy:
    - 163a252f-dade-45e6-84f7-e7ce970db7d7/deny-from-other-namespaces
  networking.k8s.io/v1beta1/Ingress:
    - 163a252f-dade-45e6-84f7-e7ce970db7d7/app
  v1/Endpoints:
    - 163a252f-dade-45e6-84f7-e7ce970db7d7/mysql
    - 163a252f-dade-45e6-84f7-e7ce970db7d7/app
  v1/Event:
    - 163a252f-dade-45e6-84f7-e7ce970db7d7/app-77575776b6-v7lgt.160bc152e2565d97
  v1/Namespace:
    - 163a252f-dade-45e6-84f7-e7ce970db7d7
  v1/PersistentVolume:
    - pvc-5768686b-8b5e-11ea-9cac-42010aa200b6
    - pvc-579abc6a-8b5e-11ea-9cac-42010aa200b6
  v1/PersistentVolumeClaim:
    - 163a252f-dade-45e6-84f7-e7ce970db7d7/mysql-mysql-0
    - 163a252f-dade-45e6-84f7-e7ce970db7d7/site-code
  v1/Pod:
    - 163a252f-dade-45e6-84f7-e7ce970db7d7/mysql-0
    - 163a252f-dade-45e6-84f7-e7ce970db7d7/app-77575776b6-v7lgt
  v1/ResourceQuota:
    - 163a252f-dade-45e6-84f7-e7ce970db7d7/gke-resource-quotas
  v1/Secret:
    - 163a252f-dade-45e6-84f7-e7ce970db7d7/default-token-npt4b    
    - 163a252f-dade-45e6-84f7-e7ce970db7d7/app
  v1/Service:
    - 163a252f-dade-45e6-84f7-e7ce970db7d7/mysql
    - 163a252f-dade-45e6-84f7-e7ce970db7d7/app
  v1/ServiceAccount:
    - 163a252f-dade-45e6-84f7-e7ce970db7d7/default
```
comment