velero backup failing for GKE Cluster

10/5/2020

I am trying with velero to create backup of GKE Cluster . I installed successfully on the GKE Cluster as shown below

   $ kubectl get deployment/velero --namespace velero
   NAME     READY   UP-TO-DATE   AVAILABLE   AGE
   velero   1/1     1            1           43h 

   $ kubectl get pods --namespace velero
   NAME                      READY   STATUS    RESTARTS    AGE
   velero-847c69f497-hwv6l   1/1     Running     0          43h  

I executed below command to initiate backup

  $ velero backup create cluster1-backup --include-namespaces default --snapshot-volumes
  Backup request "cluster1-backup" submitted successfully.
  Run `velero backup describe cluster1-backup` or `velero backup logs cluster1-backup` for more details.

It looks the backup process failed

  $ velero backup describe cluster1-backup
   Name:         cluster1-backup
   Namespace:    velero
   Labels:       velero.io/storage-location=default
   Annotations:  velero.io/source-cluster-k8s-gitversion=v1.15.12-gke.20
   velero.io/source-cluster-k8s-major-version=1
   velero.io/source-cluster-k8s-minor-version=15+

   Phase:  Failed (run `velero backup logs cluster1-backup` for more information)

   Errors:    0
   Warnings:  0

   Namespaces:
   Included:  default
   Excluded:  <none>

   Resources:
   Included:        *
   Excluded:        <none>
   Cluster-scoped:  auto
   Label selector:  <none>
   Storage Location:  default
   Velero-Native Snapshot PVs:  true
   TTL:  720h0m0s
   Hooks:  <none>
   Backup Format Version:  1.1.0

   Started:    2020-10-05 09:57:12 +0000 UTC
   Completed:  <n/a>

   Expiration:  2020-11-04 09:57:12 +0000 UTC
   Velero-Native Snapshots: <none included>

  $ velero get backups
  NAME              STATUS   ERRORS   WARNINGS   CREATED  EXPIRES   STORAGE LOCATION   SELECTOR
 cluster1-backup    Failed   0        0     2020-10-05 09:57:12 +0000 UTC   29d default        <none>

Logs show the following

$ velero backup logs cluster1-backup
An error occurred: timed out waiting for download URL

I am using public GKE Cluster on a SharedVPC with Master Authorized Networks enabled only to 35.235.240.0/20 . Any suggestions to resolve the issue ?

-- Zama Ques
backup
google-kubernetes-engine
kubernetes
velero

1 Answer

10/5/2020

The issue is resolved now

Was seeing below error in log

 kubectl logs deployment/velero -n velero
 

time="2020-10-05T13:41:19Z" level=error msg="Error getting backup store for this location" backupLocation=default controller=backup-sync error="backup storage location's bucket name \"gs://bucketname/\" must not contain a '/' (if using a prefix, put it in the 'Prefix' field instead)" error.file="/go/src/github.com/vmware-tanzu/velero/pkg/persistence/object_store.go:110" error.function=github.com/vmware-tanzu/velero/pkg/persistence.NewObjectBackupStore logSource="pkg/controller/backup_sync_controller.go:168"

There was an '/' after the bucket name while creating the environmental variable

It seems when creating the environmental variable , we donot have to add "gs://" in the environmental variable.

            BUCKET=bucketname

If the bucket does not exist create the bucket as shown below

  gsutil mb gs://$BUCKET/

During installation of velero server , do not add gs:// before bucket name in the velero install command as shown below

 velero install --provider gcp --plugins velero/velero-plugin-for-gcp:v1.1.0 --bucket $BUCKET  --secret-file ./credentials-velero

BUCKET=bucketname

$ velero backup describe backup-test-ns
Name:         backup-test-ns
Namespace:    velero
Labels:       <none>
Annotations:  <none>

Phase:  New

Errors:    0
Warnings:  0

Namespaces:
   Included:  backup-test
   Excluded:  <none>

 Resources:
    Included:        *
    Excluded:        <none>
    Cluster-scoped:  auto

 Label selector:  <none>

 Storage Location:

 Velero-Native Snapshot PVs:  auto

 TTL:  720h0m0s

 Hooks:  <none>

 Backup Format Version:

 Started:    <n/a>
 Completed:  <n/a>

 Expiration:  <nil>

 Velero-Native Snapshots: <none included>

It may be necessary for you to delete existing velero installation before trying a new installation . To uninstall velero use below command

      kubectl delete namespace -n velero
-- Zama Ques
Source: StackOverflow