Sign inSign up

jdopensource/velero-plugin-for-jdcloud

By jdopensource

Updated 8 months ago

Velero plugin for jdcloud

Image
Developer tools
0

220

jdopensource/velero-plugin-for-jdcloud repository overview

Velero Deployment

Overview

This plugin is used for saving and retrieving backup data on JDCloud OSS as an object storage plugin. The backup includes metadata files of Kubernetes resources and CSI objects, as well as the progress of asynchronous operations. It is also used to store result data from backups and restores, including log files, warning/error files, and more.

Prerequisites

  • JKE cluster
  • Git
  • Docker
  • Docker-buildx

Deployment

  1. Log in to a node in the JKE cluster and connect to the cluster.

  2. Install the Velero CLI tool.

    Download velero-v1.17.1-linux-amd64.tar.gz from the official website and upload it to the node.

    Extract Velero:

    tar -xvf velero-v1.17.1-linux-amd64.tar.gz
    mv velero-v1.17.1-linux-amd64/velero /usr/local/bin/velero
    
  3. Build the Velero plugin image.

    Clone the Velero plugin repository:

    git clone https://github.com/jd-opensource/velero-plugin-for-jdcloud.git
    

    Build the image:

    cd velero-plugin-for-jdcloud
    make docker-build IMAGE="my.hub.com/base/velero-plugin-for-jdcloud" VERSION="v1.0.0"
    
  4. Create a new OSS bucket. The bucket should not contain other directories.

  5. Create a credentials configuration file.

    mkdir velero
    vi /home/velero/credentials-velero
    

    Add the following content:

    JDCLOUD_OSS_ACCESS_KEY=<Your AK>
    JDCLOUD_OSS_SECRET_KEY=<Your SK>
    
  6. Install Velero using the CLI tool.

    velero install \
        --provider jdcloud.com/jdcloud \
        --plugins my.hub.com/base/velero-plugin-for-jdcloud:v1.0.0 \
        --bucket <Your Bucket> \
        --prefix "default-prefix/" \
        --secret-file /home/velero/credentials-velero \
        --backup-location-config \
          endpoint=<Your Endpoint>,region="cn-north-1",s3ForcePathStyle="true",bucket="my-bucket",profile="default",insecureSkipTLSVerify="true",credentialsFile="/credentials/cloud"
    

    Replace <Your Bucket> and <Your Endpoint> with your bucket name and endpoint.

    Enter the JKE cluster, upgrade the Velero workload, replace the image with the one uploaded to JD Image Serve.

  7. Check the storage location status.

    velero backup-location get
    

    available indicates a successful installation.

  8. Backup data.

    Backup all resources in the default namespace:

    velero backup create default-backup --include-namespaces default
    

    Check if the backup was successful:

    velero backup get
    

    completed indicates the backup was successful.

    View details and logs:

    velero backup describe default-backup
    velero backup logs default-backup
    
  9. Delete resources in the default namespace.

  10. Restore resources.

    Update the backup storage location to read-only mode:

    kubectl patch backupstoragelocation default \
        --namespace velero \
        --type merge \
        --patch '{"spec":{"accessMode":"ReadOnly"}}'
    

    Restore resources using the created backup:

    velero restore create --from-backup default-backup
    

    Check the restore status:

    velero restore get
    

    completed indicates a successful restore.

    Restore the backup storage location to read-write mode:

    kubectl patch backupstoragelocation default \
        --namespace velero \
        --type merge \
        --patch '{"spec":{"accessMode":"ReadWrite"}}'
    
  11. Delete a backup.

    velero backup delete default-backup
    
  12. Uninstall Velero resources.

    kubectl delete namespace/velero clusterrolebinding/velero
    kubectl delete crds -l component=velero
    

Tag summary

Content type

Image

Digest

sha256:a94c9247a

Size

24.2 MB

Last updated

8 months ago

docker pull jdopensource/velero-plugin-for-jdcloud:v1.0.0