gpt4 book ai didi

kubernetes - 批量更新所有 Kubernetes 部署 API 版本

转载 作者:行者123 更新时间:2023-12-02 12:01:37 24 4
gpt4 key购买 nike

我正在使用 apiversion : apps/v1beta2在大多数部署中,但是 Kubernetes 集群版本 1.14推荐使用apiversion : apps/v1 . v1beta2 也将从 Kubernetes 1.16 中弃用。 .

有没有更好的选择来减少手动工作并更新所有具有版本 apps/v1beta2 的部署?至v1 .

或者我可以使用 patch所有部署。

最佳答案

您可以尝试使用 move2kube ( https://github.com/konveyor/move2kube ) 工具来实现上述目的。
要实现上述目标,请执行以下操作:
创建一个定义集群类型的 yaml 文件,如下所示(调用是 clusterconfig.yaml):

apiVersion: move2kube.konveyor.io/v1alpha1
kind: ClusterMetadata
metadata:
name: Kubernetes
spec:
storageClasses:
- default
- ibmc-block-bronze
- ibmc-block-custom
- ibmc-block-gold
- ibmc-block-retain-bronze
- ibmc-block-retain-custom
- ibmc-block-retain-gold
- ibmc-block-retain-silver
- ibmc-block-silver
- ibmc-file-bronze
- ibmc-file-bronze-gid
- ibmc-file-custom
- ibmc-file-gold
- ibmc-file-gold-gid
- ibmc-file-retain-bronze
- ibmc-file-retain-custom
- ibmc-file-retain-gold
- ibmc-file-retain-silver
- ibmc-file-silver
- ibmc-file-silver-gid
apiKindVersionMap:
APIService:
- apiregistration.k8s.io/v1
Binding:
- v1
CSIDriver:
- storage.k8s.io/v1beta1
CSINode:
- storage.k8s.io/v1
- storage.k8s.io/v1beta1
CatalogSource:
- operators.coreos.com/v1alpha1
CertificateSigningRequest:
- certificates.k8s.io/v1beta1
ClusterImagePolicy:
- securityenforcement.admission.cloud.ibm.com/v1beta1
ClusterRole:
- rbac.authorization.k8s.io/v1
- rbac.authorization.k8s.io/v1beta1
ClusterRoleBinding:
- rbac.authorization.k8s.io/v1
- rbac.authorization.k8s.io/v1beta1
ClusterServiceVersion:
- operators.coreos.com/v1alpha1
ComponentStatus:
- v1
ConfigMap:
- v1
ControllerRevision:
- apps/v1
CronJob:
- batch/v1beta1
- batch/v2alpha1
CustomResourceDefinition:
- apiextensions.k8s.io/v1
DaemonSet:
- apps/v1
Deployment:
- apps/v1
EndpointSlice:
- discovery.k8s.io/v1beta1
Endpoints:
- v1
Event:
- events.k8s.io/v1beta1
- v1
HorizontalPodAutoscaler:
- autoscaling/v1
- autoscaling/v2beta1
- autoscaling/v2beta2
ImagePolicy:
- securityenforcement.admission.cloud.ibm.com/v1beta1
Ingress:
- networking.k8s.io/v1beta1
- extensions/v1beta1
InstallPlan:
- operators.coreos.com/v1alpha1
Job:
- batch/v1
Lease:
- coordination.k8s.io/v1beta1
- coordination.k8s.io/v1
LimitRange:
- v1
LocalSubjectAccessReview:
- authorization.k8s.io/v1
- authorization.k8s.io/v1beta1
MutatingWebhookConfiguration:
- admissionregistration.k8s.io/v1beta1
- admissionregistration.k8s.io/v1
Namespace:
- v1
NetworkPolicy:
- networking.k8s.io/v1
Node:
- v1
OperatorGroup:
- operators.coreos.com/v1
PersistentVolume:
- v1
PersistentVolumeClaim:
- v1
Pod:
- v1
PodDisruptionBudget:
- policy/v1beta1
PodSecurityPolicy:
- policy/v1beta1
PodTemplate:
- v1
PriorityClass:
- scheduling.k8s.io/v1beta1
- scheduling.k8s.io/v1
ReplicaSet:
- apps/v1
ReplicationController:
- v1
ResourceQuota:
- v1
Role:
- rbac.authorization.k8s.io/v1
- rbac.authorization.k8s.io/v1beta1
RoleBinding:
- rbac.authorization.k8s.io/v1
- rbac.authorization.k8s.io/v1beta1
Secret:
- v1
SelfSubjectAccessReview:
- authorization.k8s.io/v1
- authorization.k8s.io/v1beta1
SelfSubjectRulesReview:
- authorization.k8s.io/v1
- authorization.k8s.io/v1beta1
Service:
- v1
ServiceAccount:
- v1
StatefulSet:
- apps/v1
StorageClass:
- storage.k8s.io/v1
- storage.k8s.io/v1beta1
SubjectAccessReview:
- authorization.k8s.io/v1
- authorization.k8s.io/v1beta1
Subscription:
- operators.coreos.com/v1alpha1
TokenReview:
- authentication.k8s.io/v1
- authentication.k8s.io/v1beta1
ValidatingWebhookConfiguration:
- admissionregistration.k8s.io/v1beta1
- admissionregistration.k8s.io/v1
VolumeAttachment:
- storage.k8s.io/v1
- storage.k8s.io/v1beta1

然后运行:
move2kube translate -s <folder containing your clusterconfig.yaml file and kubernetes yaml files>
交互式工具将询问所需的信息并进行翻译。

关于kubernetes - 批量更新所有 Kubernetes 部署 API 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61024889/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com