更新时间:2023-03-28 GMT+08:00
分享

备份原ACK集群的Kubernetes对象

  1. 如果需要备份带PV数据的wordpress应用,请先给对应pod加annotation,不备份PV可跳过此步。

    # kubectl -n YOUR_POD_NAMESPACE annotate pod/YOUR_POD_NAME backup.velero.io/backup-volumes=YOUR_VOLUME_NAME_1,YOUR_VOLUME_NAME_2,...  
    
    [root@iZbp1cqobeh1iyyf7qgvvzZ ack2cce]# kubectl get pod -n wordpress
    NAME   READY   STATUSRESTARTS   AGE 
    wordpress-67796d86b5-f9bfm 1/1 Running   1  39m 
    wordpress-mysql-645b796d8d-6k8wh   1/1 Running   0  38m   
    
    [root@iZbp1cqobeh1iyyf7qgvvzZ ack2cce]# kubectl -n wordpress annotate pod/wordpress-67796d86b5-f9bfm backup.velero.io/backup-volumes=wordpress-pvc 
    pod/wordpress-67796d86b5-f9bfm annotated 
    [root@iZbp1cqobeh1iyyf7qgvvzZ ack2cce]# kubectl -n wordpress annotate pod/wordpress-mysql-645b796d8d-6k8wh backup.velero.io/backup-volumes=wordpress-mysql-pvc 
    pod/wordpress-mysql-645b796d8d-6k8wh annotated

  2. 执行备份任务

    [root@iZbp1cqobeh1iyyf7qgvvzZ ack2cce]# velero backup create  wordpress-ack-backup --include-namespaces wordpress 
    Backup request "wordpress-ack-backup" submitted successfully. 
    Run `velero backup describe wordpress-ack-backup` or `velero backup logs wordpress-ack-backup` for more details.

  3. 查看备份任务是否成功

    [root@iZbp1cqobeh1iyyf7qgvvzZ ack2cce]# velero backup get 
    NAME   STATUS   CREATED EXPIRES   STORAGE LOCATION   SELECTOR 
    wordpress-ack-backup   InProgress   2020-07-07 20:31:19 +0800 CST   29d   default<none> 
    [root@iZbp1cqobeh1iyyf7qgvvzZ ack2cce]# velero backup get 
    NAME   STATUS  CREATED EXPIRES   STORAGE LOCATION   SELECTOR 
    wordpress-ack-backup   Completed   2020-07-07 20:31:19 +0800 CST   29d   default<none>

相关文档