Giter Club home page Giter Club logo

velero-plugin's Introduction

BEST EFFORT ONLY


Please note: this driver is provided on a best-effort basis and is not currently officially supported for LKE or Linode compute. Please try and let us know your feedback! Thanks.


Getting Started

This README explains how to install and configure the Linode Block Storage provider plugin for Velero. The plugin is designed to create filesystem snapshots of Block Storage backed PersistentVolumes that are used in a Kubernetes cluster running on Linode.

Prerequisites

Credentials setup

  1. To use this plugin with Velero to create persistent volume snapshots, you will need a Linode API token. Create one before proceeding with the rest of these steps.

  2. For the object storage Velero component, generate an Object Storage access key and secret key

Velero installation

  1. Complete the Prerequisites and Credentials setup steps mentioned above.

  2. Clone this repository. cd into the examples directory and edit the cloud-credentials file. The file will look like this:

    [default]
    aws_access_key_id=<AWS_ACCESS_KEY_ID>
    aws_secret_access_key=<AWS_SECRET_ACCESS_KEY>

    Edit the <AWS_ACCESS_KEY_ID> and <AWS_SECRET_ACCESS_KEY> placeholders to use your Linode Object Storage keys. Be sure to remove the < and > characters.

  3. Still in the examples directory, edit the 01-velero-secret.patch.yaml file. It should look like this:

    ---
    apiVersion: v1
    kind: Secret
    stringData:
    linode_token: <LINODE_API_TOKEN>
    type: Opaque
    • Change the entire <LINODE_API_TOKEN> portion to use your Linode personal API token. The line should look something like linode_token: 18a0d730c0e0....
  4. Now you're ready to install velero, configure the snapshot storage location, and work with backups. Ensure that you edit each of the following settings to match your Spaces configuration befor running the velero install command:

    • --bucket velero-backups - Ensure you change the velero-backups value to match the name of your Space.
    • --backup-location-config s3Url=https://us-east-1.linodeobjects.com,region=us-east-1 - Change the URL and region to match your Object Storage settings. Specifically, edit the us-east-1 portion in both to match the region where your Space is hosted. Use one of us-east-1, eu-central-1 depending on your region.
  5. Now run the install command:

    velero install \
     --provider velero.io/aws \
     --bucket velero-backups \
     --plugins velero/velero-plugin-for-aws:v1.0.1,displague/velero-plugin-linode:v0.0.1 \
     --backup-location-config s3Url=https://us-east-1.linodeobjects.com,region=us-east-1 \
     --use-volume-snapshots=false \
     --secret-file=./cloud-credentials

Snapshot configuration

  1. Enable the displague/velero-plugin-linode:v0.0.1 snapshot provider. This command will configure Velero to use the plugin for persistent volume snapshots.

    velero snapshot-location create default --provider linode.com/velero
  2. Patch the cloud-credentials Kubernetes Secret object that the velero install command installed in the cluster. This command will add your Linode API token to the cloud-credentials object so that this plugin can use the Linode API:

    kubectl patch secret cloud-credentials -p "$(cat 01-velero-secret.patch.yaml)" --namespace velero
  3. Patch the velero Kubernetes Deployment to expose your API token to the Velero pod(s). Velero needs this change in order to authenticate to the Linode API when manipulating snapshots:

    kubectl patch deployment velero -p "$(cat 02-velero-deployment.patch.yaml)" --namespace velero

Backup and restore example

  1. Install the Nginx examples/nginx-example.yaml Deployment into your cluster. The example uses a persistent volume for Nginx logs. It also creates a NodeBalancer with a public IP address:

    kubectl apply -f examples/nginx-example.yaml
  2. Ensure that your Nginx Deployment is running and there is a Service with an EXTERNAL-IP (kubectl get service --namespace nginx-example). Browse the IP a few times to write some log entries to the persistent volume. Then create a backup with Velero:

    velero backup create nginx-backup --selector app=nginx --snapshot-volumes=true
    velero backup describe nginx-backup --details
  3. The various backup files will be in your Spaces bucket. A snapshot of the persistent volume will be listed in the Linode control panel under the Volumes tab. Now you can simulate a disaster by deleting the nginx-example namespace.

    kubectl delete namespace nginx-example
  4. Once the delete finishes, restore the nginx-backup backup:

    velero restore create --from-backup nginx-backup
  5. Check the restored PersistentVolume, Deployment, and Service are back using kubectl:

    kubectl get persistentvolume --namespace nginx-example
    kubectl get service --namespace nginx-example
    kubectl get deployment --namespace nginx-example

Build the plugin

make clean
make container IMAGE=displague/velero-plugin-linode:dev

velero-plugin's People

Contributors

dependabot[bot] avatar displague avatar srust avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

velero-plugin's Issues

cloned volumes - why?

Hey @displague
Why does the plugin clone the volumes when creating backup? why not creating the volume from the snapshot only when running 'velero restore' ?

velero restore FailedAttachVolume Volume with id not found

HI,

I have done a velero (v1.13.0) backup with velero-plugin-linode without problem it create a volume snapshot on linode volumes but when I try to restore the backup I have always the error FailedAttachVolume Volume with id not found:

Warning FailedAttachVolume 118s (x9 over 4m10s) attachdetach-controller AttachVolume.Attach failed for volume "pvc-a0f3c1b80aa24866" : rpc error: code = NotFound desc = Volume with id 3793277106 not found

can you help me please ?

Plugin Panicked error when creating backup

Hi guys,
I'm trying to backup my k8s cluster on linode to an aws s3 bucket, I have quite a complex architecture.
Here is the output of velero backup describe:

Name:         visidea
Namespace:    velero
Labels:       velero.io/storage-location=default
Annotations:  velero.io/resource-timeout=10m0s
              velero.io/source-cluster-k8s-gitversion=v1.26.9
              velero.io/source-cluster-k8s-major-version=1
              velero.io/source-cluster-k8s-minor-version=26

Phase:  PartiallyFailed (run `velero backup logs visidea` for more information)


Warnings:
  Velero:    error: /the server is currently unable to handle the request
             error: /the server is currently unable to handle the request
  Cluster:    <none>
  Namespaces: <none>

Errors:
  Velero:   
             name: /elasticsearch-es-data-0 error: /error taking snapshot of volume: rpc error: code = Aborted desc = plugin panicked: runtime error: invalid memory address or nil pointer dereference
            
             name: /elasticsearch-es-data-1 error: /error taking snapshot of volume: rpc error: code = Aborted desc = plugin panicked: runtime error: invalid memory address or nil pointer dereference
            
             name: /elasticsearch-es-data-2 error: /error taking snapshot of volume: rpc error: code = Aborted desc = plugin panicked: runtime error: invalid memory address or nil pointer dereference
            
             name: /elasticsearch-es-master-0 error: /error taking snapshot of volume: rpc error: code = Aborted desc = plugin panicked: runtime error: invalid memory address or nil pointer dereference
            
             name: /ir-crawler-to-k8s-68558887cb-lzv4p error: /error taking snapshot of volume: rpc error: code = Aborted desc = plugin panicked: runtime error: invalid memory address or nil pointer dereference
            
             name: /mongobackup-859c85666f-snsqw error: /error taking snapshot of volume: rpc error: code = Aborted desc = plugin panicked: runtime error: invalid memory address or nil pointer dereference
            
             name: /mongodb-api-0 error: /error taking snapshot of volume: rpc error: code = Aborted desc = plugin panicked: runtime error: invalid memory address or nil pointer dereference
            
             name: /mongodb-api-1 error: /error taking snapshot of volume: rpc error: code = Aborted desc = plugin panicked: runtime error: invalid memory address or nil pointer dereference
             name: /mongodb-api-2 error: /error taking snapshot of volume: rpc error: code = Aborted desc = plugin panicked: runtime error: invalid memory address or nil pointer dereference
            
            
             name: /mongodb-harness-0 error: /error taking snapshot of volume: rpc error: code = Aborted desc = plugin panicked: runtime error: invalid memory address or nil pointer dereference
            
             name: /mongodb-harness-1 error: /error taking snapshot of volume: rpc error: code = Aborted desc = plugin panicked: runtime error: invalid memory address or nil pointer dereference
            
             name: /mongodb-harness-2 error: /error taking snapshot of volume: rpc error: code = Aborted desc = plugin panicked: runtime error: invalid memory address or nil pointer dereference
            
             name: /recommendify-apish-7574c4c55f-9fdq4 error: /error taking snapshot of volume: rpc error: code = Aborted desc = plugin panicked: runtime error: invalid memory address or nil pointer dereference
            
             name: /recommendify-cronjobs-crawl-28334355-47cqd error: /error taking snapshot of volume: rpc error: code = Aborted desc = plugin panicked: runtime error: invalid memory address or nil pointer dereference
            
             name: /data-my-release-etcd-0 error: /error taking snapshot of volume: rpc error: code = Aborted desc = plugin panicked: runtime error: invalid memory address or nil pointer dereference
            
             name: /data-my-release-etcd-1 error: /error taking snapshot of volume: rpc error: code = Aborted desc = plugin panicked: runtime error: invalid memory address or nil pointer dereference
            
             name: /data-my-release-etcd-2 error: /error taking snapshot of volume: rpc error: code = Aborted desc = plugin panicked: runtime error: invalid memory address or nil pointer dereference
            
             name: /datadir-mongodb-ir-0 error: /error taking snapshot of volume: rpc error: code = Aborted desc = plugin panicked: runtime error: invalid memory address or nil pointer dereference
            
             name: /datadir-mongodb-ir-1 error: /error taking snapshot of volume: rpc error: code = Aborted desc = plugin panicked: runtime error: invalid memory address or nil pointer dereference
            
             name: /datadir-mongodb-ir-2 error: /error taking snapshot of volume: rpc error: code = Aborted desc = plugin panicked: runtime error: invalid memory address or nil pointer dereference
            
            
             name: /mongo-claim0 error: /error taking snapshot of volume: rpc error: code = Aborted desc = plugin panicked: runtime error: invalid memory address or nil pointer dereference
            
            
             name: /mongo-claim1 error: /error taking snapshot of volume: rpc error: code = Aborted desc = plugin panicked: runtime error: invalid memory address or nil pointer dereference
  Cluster:    <none>
  Namespaces: <none>

Namespaces:
  Included:  default
  Excluded:  <none>

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

Label selector:  <none>

Or label selector:  <none>

Storage Location:  default

Velero-Native Snapshot PVs:  auto
Snapshot Move Data:          false
Data Mover:                  velero

TTL:  720h0m0s

CSISnapshotTimeout:    20m0s
ItemOperationTimeout:  4h0m0s

Hooks:  <none>

Backup Format Version:  1.1.0

Started:    2023-11-15 17:47:16 +0100 CET
Completed:  2023-11-15 17:47:30 +0100 CET

Expiration:  2023-12-15 17:47:16 +0100 CET

Total items to be backed up:  427
Items backed up:              427

Velero-Native Snapshots:  0 of 22 snapshots completed successfully (specify --details for more information)

I am currently installing velero via this command:

PLUGIN="velero/velero-plugin-for-aws:v1.0.1,displague/velero-plugin-linode:v0.0.1"

velero install \
    --provider aws \
    --bucket $BUCKET \
    --secret-file $SECRET\
    --backup-location-config region=$REGION,s3ForcePathStyle="true"\
    --use-volume-snapshots=false \
    --plugins $PLUGIN \

I'm using version 1.12 of velero.

Versions of kubernetes are as follows:

  • Client Version: v1.28.1
  • Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
  • Server Version: v1.26.9

GETTING ERROR WHILE DOING BACKUP

getting this error

time="2022-04-01T08:36:44Z" level=error msg="Error listing backups in backup store" backupLocation=default controller=backup-sync error="rpc error: code = Unknown desc = RequestError: send request failed\ncaused by: Get https://snapshot-volume-backup.snapshot-volume-backup.us-southeast-1.linodeobjects.com/?delimiter=%2F&list-type=2&prefix=backups%2F: x509: certificate is valid for *.us-southeast-1.linodeobjects.com, *.website-us-southeast-1.linodeobjects.com, us-southeast-1.linodeobjects.com, website-us-southeast-1.linodeobjects.com, not snapshot-volume-backup.snapshot-volume-backup.us-southeast-1.linodeobjects.com" error.file="/go/src/github.com/vmware-tanzu/velero-plugin-for-aws/velero-plugin-for-aws/object_store.go:308" error.function="main.(*ObjectStore).ListCommonPrefixes" logSource="pkg/controller/backup_sync_controller.go:182"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.