helm repo add minio https://helm.min.io/
- [root@k8s-master]-[~]-#kubectl get sc
- NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
- hostpath (default) hostpath Delete Immediate false 22h
- nfs-storage (default) nfs-provisioner Delete Immediate false 21h
- helm install minio \
- --namespace minio --create-namespace \ #创建ns
- --set accessKey=minio,secretKey=minio123 \ #设置Minio登录用户名和密码
- --set mode=standalone \ #设置Minio部署模式(standalone 为单机版/distributed 为集群版)
- --set service.type=NodePort \ #svc暴露方式
- --set persistence.enabled=true \
- --set persistence.size=10Gi \
- --set persistence.storageClass=nfs-storage \ #sc名称
- minio/minio
- [root@k8s-master]-[~]-#helm list -n minio
- NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
- minio minio 1 2022-08-24 11:10:19.693430288 +0800 CST deployed minio-8.0.10 master
- [root@k8s-master]-[~]-#kubectl get po,svc,pv,pvc -n minio
- NAME READY STATUS RESTARTS AGE
- pod/minio-785789b757-qb4m9 0/1 Pending 0 142m
- pod/minio-785789b757-x4x7n 1/1 Terminating 0 173m
-
- NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
- service/minio NodePort 10.96.3.101 <none> 9000:32000/TCP 3h
-
- NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
- persistentvolume/pvc-646a2716-b75b-45c2-b2d5-cc87067b57c1 10Gi RWO Delete Bound minio/minio nfs-storage 3h
- persistentvolume/pvc-b338069d-ed8f-47d4-abed-39549a050c22 10Mi RWO Delete Bound default/www-web-1 nfs-storage 20h
- persistentvolume/pvc-b602da77-a9e5-4fb6-ba89-7a3351cbe96d 10Mi RWO Delete Bound default/www-web-0 nfs-storage 20h
-
- NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
- persistentvolumeclaim/minio Bound pvc-646a2716-b75b-45c2-b2d5-cc87067b57c1 10Gi RWO nfs-storage 3h
登录Minio页面-正常


- wget https://github.com/vmware-tanzu/velero/releases/download/v1.8.1/velero-v1.8.1-linux-amd64.tar.gz
- tar xvf velero-v1.8.1-linux-amd64.tar.gz
- cp velero-v1.8.1-linux-amd64/velero /usr/local/bin/
-
- #检查是否安装完成
- velero version
- #使用安装集群创建的证书即可
- #创建认证文件
- cd /root/.kube/
- vim velero-auth.txt
- [default]
- aws_access_key_id = minio
- aws_secret_access_key = minio123 #此处为安装Minio的用户名和密码
- #创建namespace:
- kubectl create ns velero-system
- velero --kubeconfig /root/.kube/config \
- install \
- --provider aws \
- --plugins velero/velero-plugin-for-aws:v1.3.1 \
- --bucket velerodata \
- --secret-file ./velero-auth.txt \
- --use-volume-snapshots=false \
- --namespace velero-system \
- --backup-location-config region=minio,s3ForcePathStyle="true",s3Url=http://10.0.0.17:32000

- #备份monitoring
- velero backup create monitoring-ns-backup-20220824 \
- --include-cluster-resources=true \
- --include-namespaces monitoring \
- --kubeconfig=/root/.kube/config \
- --namespace velero-system
-
- #被封dev
- velero backup create dev-ns-backup-20220824 \
- --include-cluster-resources=true \
- --include-namespaces dev \
- --kubeconfig=/root/.kube/config \
- --namespace velero-system


删除dev命名空间下的pod并验证数据恢复

恢复数据:
velero restore create --from-backup dev-ns-backup-20220824 --kubeconfig=/root/.kube/config --namespace velero-system
检查数据是否已经恢复:


velero还支持定时备份以及K8s集群迁移和复制等功能,更多功能请关注官网:Velero Docs - Overview