启用 Velero API group version 功能来帮助缓解兼容性问题

2022-12-14 14:49:08 浏览数 (1)

启用 Velero API group version 功能来帮助缓解兼容性问题

默认情况下,Kubernetes 允许在集群之间更改 API group version ,只要升级是单个版本(例如 v1 -> v2beta1), 跳转到多个版本(例如 v1 -> v3)不是现成的, 这就是 Velero 启用 API group version 功能可以在升级期间提供帮助的地方.

目前启用 API group version 功能处于测试阶段,启用可以通过安装 Velero 带有功能标志,--features=EnableAPIGroupVersions.

有关 Kubernetes API 版本兼容性的最新信息,在开始升级、迁移或还原之前,应始终查看源集群版本和目标集群版本的 Kubernetes release notes, 如果 Kubernetes API 版本之间存在差异,使用启用 API group version 功能来帮助缓解兼容性问题.

本示例环境

注,在使用此功能时注意检查 Kubernetes 与 velero 兼用性

代码语言:javascript复制
// Kubernetes version
$ kubectl get no
NAME     STATUS   ROLES           AGE    VERSION
ubuntu   Ready    control-plane   138d   v1.24.3
// Velero version
$ velero version
Client:
        Version: v1.10.0
        Git commit: 367f563072659f0bcd809bc33507fd75cd722344
Server:
        Version: v1.10.0

定制版本优先级 && 启用 APIGroupVersions 的高级步骤

Install velero (前一节的基础上可安装)

代码语言:javascript复制
$ velero install 
    --provider aws 
    --plugins velero/velero-plugin-for-aws:v1.2.1 
    --bucket velero-backups 
    --secret-file /root/velero/credentials-velero 
    --use-volume-snapshots=false 
    --features=EnableAPIGroupVersions 
    --backup-location-config region=minio,s3ForcePathStyle="true",s3Url=http://192.168.86.129:32001 

CustomResourceDefinition/backuprepositories.velero.io: attempting to create resource
CustomResourceDefinition/backuprepositories.velero.io: attempting to create resource client
CustomResourceDefinition/backuprepositories.velero.io: already exists, proceeding
CustomResourceDefinition/backuprepositories.velero.io: created
CustomResourceDefinition/backups.velero.io: attempting to create resource
CustomResourceDefinition/backups.velero.io: attempting to create resource client
CustomResourceDefinition/backups.velero.io: already exists, proceeding
CustomResourceDefinition/backups.velero.io: created
CustomResourceDefinition/backupstoragelocations.velero.io: attempting to create resource
CustomResourceDefinition/backupstoragelocations.velero.io: attempting to create resource client
CustomResourceDefinition/backupstoragelocations.velero.io: already exists, proceeding
CustomResourceDefinition/backupstoragelocations.velero.io: created
CustomResourceDefinition/deletebackuprequests.velero.io: attempting to create resource
CustomResourceDefinition/deletebackuprequests.velero.io: attempting to create resource client
CustomResourceDefinition/deletebackuprequests.velero.io: already exists, proceeding
CustomResourceDefinition/deletebackuprequests.velero.io: created
CustomResourceDefinition/downloadrequests.velero.io: attempting to create resource
...
DaemonSet/node-agent: already exists, proceeding
DaemonSet/node-agent: created
Velero is installed! ⛵ Use 'kubectl logs deployment/velero -n velero' to view the status.

以上命名完成 Velero 安装并启用加入 API 组版本功能

创建一个名为 restoreResourcesVersionPriority 的文件

代码语言:javascript复制
$ vim ./restoreResourcesVersionPriority
rockbands.music.example.io=v2beta1,v2beta2
orchestras.music.example.io=v2,v3alpha1
subscriptions.operators.coreos.com=v2,v1

Apply config map with

代码语言:javascript复制
# kubectl create configmap enableapigroupversions --from-file=/root/velero/restoreResourcesVersionPriority -n velero
configmap/enableapigroupversions created

检查配置

代码语言:javascript复制
$ kubectl get configmap enableapigroupversions -n velero
NAME                     DATA   AGE
enableapigroupversions   1      56s

$ kubectl describe configmap enableapigroupversions -n velero
Name:         enableapigroupversions
Namespace:    velero
Labels:       <none>
Annotations:  <none>

Data
====
restoreResourcesVersionPriority:
----
rockbands.music.example.io=v2beta1,v2beta2
orchestras.music.example.io=v2,v3alpha1
subscriptions.operators.coreos.com=v2,v1


BinaryData
====

Events:  <none>

以上已完成对 Velero 组版本功能的配置!

0 人点赞