Это мой сценарий 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;
Код: Выделить всё
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
mysql-resources-backup InProgress 0 0 2025-01-18 01:54:43 +0000 UTC 29d default
Код: Выделить всё
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:
Resources:
Included: *
Excluded:
Cluster-scoped: auto
Label selector:
Or label selector:
Storage Location: default
Velero-Native Snapshot PVs: true
Snapshot Move Data: true
Data Mover: velero
TTL: 720h0m0s
CSISnapshotTimeout: 10m0s
ItemOperationTimeout: 4h0m0s
Hooks:
Backup Format Version: 1.1.0
Started: 2025-01-18 01:54:43 +0000 UTC
Completed:
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 Volumes:
Velero-Native Snapshots:
CSI Snapshots:
Pod Volume Backups - kopia:
New:
mysql/mysql-c5bd89b69-bgwkt: mysql-persistent-storage
Подробнее здесь: https://stackoverflow.com/questions/793 ... inprogress
Мобильная версия