Velero 备份处于 InProgress 状态的 Digital Ocean Kubernetes 集群

问题描述 投票:0回答:1

我目前正在编写一个部署脚本来备份集群资源和数据。为了测试脚本,我创建了一个 MySQL 部署并向数据库添加了数据,以测试资源和数据是否移动到新集群。

这是我的 Velero 脚本;

kube_config_path=$1
clustername=$2
namespace="mysql"

sudo velero install --provider aws \
    --plugins velero/velero-plugin-for-aws:v1.10.0 \
    --secret-file /home/velero-cred \
    --bucket $bucketName \
    --prefix $clustername \
    --backup-location-config region=eu-central-1,s3Url=https://s3.eu-central-1.amazonaws.com \
    --snapshot-location-config region=eu-central-1 \
    --use-node-agent \
    --features=EnableCSI \
    --default-volumes-to-fs-backup=true \
    --default-snapshot-move-data=true \
    --kubeconfig $kube_config_path

sleep 40
if [ -z "$namespace" ]; then
    velero backup create crd-backup --include-resources=CustomResourceDefinition --kubeconfig=$kube_config_path
    velero backup create full-cluster-backup --snapshot-volumes=true --snapshot-move-data=true --kubeconfig=$kube_config_path
else
    velero backup create crd-backup --include-resources=CustomResourceDefinition --kubeconfig=$kube_config_path
    velero backup create $namespace-resources-backup --include-namespaces $namespace --snapshot-volumes=true --snapshot-move-data=true --kubeconfig=$kube_config_path
fi

对于 MySQL 部署,我使用此安装在集群中创建了一个 NFS 存储类。

这是我的 MySQL 部署清单;

apiVersion: v1
kind: Namespace
metadata:
  creationTimestamp: null
  name: mysql
spec: {}
status: {}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: mysql-pv-claim
  namespace: mysql
spec:
  storageClassName: nfs
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
---
apiVersion: v1
kind: Secret
metadata:
  namespace: mysql
  name: mysql-secret
type: kubernetes.io/basic-auth
stringData:
  password: YourPassword$@
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: mysql
  namespace: mysql
spec:
  selector:
    matchLabels:
      app: mysql
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: mysql
    spec:
      containers:
      - image: mysql:latest
        name: mysql
        env:
        - name: MYSQL_ROOT_PASSWORD
          valueFrom:
            secretKeyRef:
              name: mysql-secret
              key: password
        ports:
        - containerPort: 3306
          name: mysql
        volumeMounts:
        - name: mysql-persistent-storage
          mountPath: /var/lib/mysql
      volumes:
      - name: mysql-persistent-storage
        persistentVolumeClaim:
          claimName: mysql-pv-claim

---
apiVersion: v1
kind: Service
metadata:
  namespace: mysql
  name: mysql
spec:
  ports:
  - port: 3306
  selector:
    app: mysql

运行备份脚本后,这就是我得到的

velero backup get --kubeconfig /home/kubeconfigs/velero-test-kubeconfig.yaml
NAME                     STATUS       ERRORS   WARNINGS   CREATED                         EXPIRES   STORAGE LOCATION   SELECTOR
crd-backup               Completed    0        0          2025-01-18 01:54:42 +0000 UTC   29d       default            <none>
mysql-resources-backup   InProgress   0        0          2025-01-18 01:54:43 +0000 UTC   29d       default            <none>

当我描述

mysql-resources-backup
时,这就是我得到的;

Name:         mysql-resources-backup
Namespace:    velero
Labels:       velero.io/storage-location=default
Annotations:  velero.io/resource-timeout=10m0s
              velero.io/source-cluster-k8s-gitversion=v1.31.1
              velero.io/source-cluster-k8s-major-version=1
              velero.io/source-cluster-k8s-minor-version=31

Phase:  InProgress


Namespaces:
  Included:  mysql
  Excluded:  <none>

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

Label selector:  <none>

Or label selector:  <none>

Storage Location:  default

Velero-Native Snapshot PVs:  true
Snapshot Move Data:          true
Data Mover:                  velero

TTL:  720h0m0s

CSISnapshotTimeout:    10m0s
ItemOperationTimeout:  4h0m0s

Hooks:  <none>

Backup Format Version:  1.1.0

Started:    2025-01-18 01:54:43 +0000 UTC
Completed:  <n/a>

Expiration:  2025-02-17 01:54:43 +0000 UTC

Estimated total items to be backed up:  22
Items backed up so far:                 0

Resource List:  <backup resource list not found>

Backup Volumes:
  Velero-Native Snapshots: <none included>

  CSI Snapshots: <none included or not detectable>

  Pod Volume Backups - kopia:
    New:
      mysql/mysql-c5bd89b69-bgwkt: mysql-persistent-storage

我需要指导我做错了什么以及如何解决这个问题。

mysql kubernetes digital-ocean velero
1个回答
0
投票

请正确描述您的错误。您的错误没有在这里正确说明。您仅显示了描述备份时看到的内容,而没有在描述中看到任何错误。

© www.soinside.com 2019 - 2024. All rights reserved.