Alauda Data Services Relational Database E1 v4.3.0 中移除 MySQL-PXC
如果您有 MySQL-PXC 实例,则在升级到 ACP v4.3.0 或更高版本后(同时升级 MySQL operator 时),这些实例将变为不受管理。有关迁移说明,请参阅 MySQL Operator 升级指南。
在升级前完成以下步骤。每次升级都要重新准备,包括 ACP 版本(Distribution Version)的补丁升级,以及在每个业务集群完成升级前对 global 的升级。
在使用 Alauda Container Platform Global Cluster Disaster Recovery 的 DR 环境中,凡是涉及 global 的步骤,都必须在两个 global 集群上执行。如果您的集群运行在多个 provider 上,请为每个 provider 完成这些步骤,包括 global 集群所在的 provider。
在 DR 环境中,准备一个指向备用 global 集群 VIP 的 kubeconfig:<standby-kubeconfig>。例如,从备用集群的控制平面节点复制 /etc/kubernetes/admin.conf 及其引用的所有证书文件;如果其 server 指向其他地址,请将其设置为 VIP。
解压后的目标 Core Package,在所有集群升级完成之前一直保留在此主机上。
使用平台管理员账号登录一次,并确保未设置 KUBECONFIG:
ac login https://<platform-address> --name <session>ac config use-cluster <cluster-name>ac whoami --show-serverac config use-cluster global
会话保存在 ~/.kube/config 中,ac 命令会在 global 上运行;在 DR 环境中,它是主集群。对于业务集群,先运行 ac config use-cluster <cluster-name>,然后运行 ac config use-cluster global;ac whoami --show-server 随后会以 /kubernetes/<cluster-name>/ 结束。
upgrade.sh 会使用 kubectl 和此会话。请在脚本运行前立即执行 ac config use-cluster global。
对于备用集群,先运行 export KUBECONFIG=<standby-kubeconfig>,确认 ac whoami --show-server 输出的是备用集群 VIP,然后再运行 unset KUBECONFIG。
适用范围:在 global 上注册的每个集群,包括 global 和导入的集群。在 DR 环境中,对每个 global 集群执行此操作;在备用集群上,只读取其自身的版本。
在 global 上,列出每个集群的 ACP 版本(第一个列表中的 CURRENT 列)、Kubernetes 版本和基础设施 provider。在最后一个列表中,DCSCluster、BaremetalCluster、HCSCluster 和 VSphereCluster 表示 Alauda OS 集群,UserProvisionedCluster 表示未运行 Alauda OS 的集群,而 <none> 表示导入的集群:
ac config use-cluster globalac whoami --show-serverac -n cpaas-system get cvshac -n cpaas-system get clusters.clusterregistry.k8s.io -o custom-columns='NAME:.metadata.name,KUBERNETES:.status.version'ac -n cpaas-system get clusters.cluster.x-k8s.io -o custom-columns='NAME:.metadata.name,INFRASTRUCTURE:.spec.infrastructureRef.kind'
如果 cvsh 报告 the server doesn't have a resource type,或未列出某个集群,请从 VERSION 获取该集群的 ACP 版本:
ac get clustermodule -o custom-columns='NAME:.metadata.name,VERSION:.spec.version'
在 DR 环境中,从 CURRENT 读取备用集群的版本;如果 cvsh 不可用,则从 VERSION 读取:
ac --kubeconfig <standby-kubeconfig> -n cpaas-system get cvsh globalac --kubeconfig <standby-kubeconfig> get clustermodule global -o custom-columns='NAME:.metadata.name,VERSION:.spec.version'
适用于:每个 global 集群。在 DR 环境中,也要在备用集群上运行每个代码块,具体可参阅首行和末行的注释:从 export KUBECONFIG=<standby-kubeconfig> 开始,以 unset KUBECONFIG 结束。
将此脚本保存为 check-global-common.sh:
#!/usr/bin/env bashac whoami --show-serverecho "== Registry"ac get productbase base -o jsonpath='external={.spec.registry.external}{"\n"}'echo "== Modules"ac get moduleinfo -l cpaas.io/cluster-name=global \ -o custom-columns='MODULE:.metadata.labels.cpaas\.io/module-name,CURRENT:.status.version,TARGET:.spec.version,PHASE:.status.phase'echo "== etcd backup records"ac get etcdbackupconfiguration etcd-backup-default \ -o jsonpath='{range .status.records[*]}{.backupTimestamp}{"\t"}{.result}{"\n"}{end}'
然后运行脚本:
ac config use-cluster global # on the standby, instead: export KUBECONFIG=<standby-kubeconfig>bash check-global-common.sh# on the standby: unset KUBECONFIG
external= 的值为空或为 false 时,表示使用平台内置的 Registry。使用该 Registry 时,在 global 的每个控制平面节点上,运行与该节点 OS 对应的命令行:
#!/usr/bin/env bashac whoami --show-serverecho "== MachineDeployments"ac -n cpaas-system get machinedeployment -l cluster.x-k8s.io/cluster-name=global \ -o custom-columns='NAME:.metadata.name,UNAVAILABLE:.spec.strategy.rollingUpdate.maxUnavailable'echo "== Machines, IP pools, and the type and address of the control-plane load balancer"ac -n cpaas-system get dcsmachine -l cluster.x-k8s.io/cluster-name=global \ -o custom-columns='NAME:.metadata.name,POOL:.spec.ipHostPoolRef.name,IP:.status.networkConfig.ip'ac -n cpaas-system get dcsiphostnamepool \ -o custom-columns='NAME:.metadata.name,IPS:.spec.pool[*].ip,DISKS:.spec.pool[*].persistentDisk[*].slot,KEPT_DISKS:.status.persistentDiskStatus[*].ip'ac -n cpaas-system get dcscluster global -o jsonpath='{.spec.controlPlaneLoadBalancer.type}{" "}{.spec.controlPlaneLoadBalancer.host}{"\n"}'echo "== Secrets that the DCSCluster references"ac -n cpaas-system get secret $(ac -n cpaas-system get dcscluster global -o jsonpath='{.spec.credentialSecretRef.name} {.spec.encryptionProviderConfigRef.name}')echo "== Local, hostPath, and TopoLVM PersistentVolumes with a claim"ac get pv --no-headers \ -o custom-columns='NAME:.metadata.name,CLAIM_NAMESPACE:.spec.claimRef.namespace,CLAIM:.spec.claimRef.name,LOCAL:.spec.local.path,HOSTPATH:.spec.hostPath.path,CSI:.spec.csi.driver' \ | awk '$2 !~ /^(<none>|kube-system|kube-public|kube-node-lease|cpaas-system)$/ && ($4 != "<none>" || $5 != "<none>" || $6 ~ /^topolvm\.(io|cybozu\.com)$/)'
然后运行:
ac config use-cluster global # on the standby, instead: export KUBECONFIG=<standby-kubeconfig>bash check-global-dcs.sh# on the standby: unset KUBECONFIG
可用条目是 POOL 中某个池的 IP 地址,其 DISKS 列出了槽位号,该地址未被任何机器使用,并且在类型为 internal 时不是负载均衡器地址。
#!/usr/bin/env bashac whoami --show-serverKCP=$(ac -n cpaas-system get clusters.cluster.x-k8s.io global -o jsonpath='{.spec.controlPlaneRef.name}')echo "== Rollout settings"ac -n cpaas-system get kubeadmcontrolplane "${KCP}" -o jsonpath='replicas={.spec.replicas} maxSurge={.spec.rolloutStrategy.rollingUpdate.maxSurge}{"\n"}'ac -n cpaas-system get machinedeployment -l cluster.x-k8s.io/cluster-name=global \ -o custom-columns='NAME:.metadata.name,SURGE:.spec.strategy.rollingUpdate.maxSurge'echo "== Machine templates in use"ac -n cpaas-system get dcsmachinetemplate \ $(ac -n cpaas-system get kubeadmcontrolplane "${KCP}" -o jsonpath='{.spec.machineTemplate.infrastructureRef.name}') \ $(ac -n cpaas-system get machinedeployment -l cluster.x-k8s.io/cluster-name=global -o jsonpath='{.items[*].spec.template.spec.infrastructureRef.name}') \ -o custom-columns='NAME:.metadata.name,TEMPLATE_DISKS:.spec.template.spec.vmConfig.dcsMachineDiskSpec[*].path'echo "== Machines"ac -n cpaas-system get dcsmachine -l cluster.x-k8s.io/cluster-name=global \ -o custom-columns='NAME:.metadata.name,VM_TEMPLATE:.spec.vmTemplateName,READY:.status.ready'echo "== Kubelet patch files: the encoding, then the content or a Secret name and key"echo "${KCP}:"ac -n cpaas-system get kubeadmcontrolplane "${KCP}" -o jsonpath='{range .spec.kubeadmConfigSpec.files[?(@.path=="/etc/kubernetes/patches/kubeletconfiguration0+strategic.json")]}{"encoding=["}{.encoding}{"] "}{.content}{.contentFrom.secret.name}{" "}{.contentFrom.secret.key}{"\n"}{end}'for t in $(ac -n cpaas-system get machinedeployment -l cluster.x-k8s.io/cluster-name=global -o jsonpath='{.items[*].spec.template.spec.bootstrap.configRef.name}'); do echo "${t}:" ac -n cpaas-system get kubeadmconfigtemplate "${t}" -o jsonpath='{range .spec.template.spec.files[?(@.path=="/etc/kubernetes/patches/kubeletconfiguration0+strategic.json")]}{"encoding=["}{.encoding}{"] "}{.content}{.contentFrom.secret.name}{" "}{.contentFrom.secret.key}{"\n"}{end}'doneecho "== Pods with hostPath volumes"ac get pods -A --no-headers \ -o custom-columns='NAMESPACE:.metadata.namespace,NAME:.metadata.name,OWNER:.metadata.ownerReferences[*].kind,MIRROR:.metadata.annotations.kubernetes\.io/config\.mirror,PHASE:.status.phase,HOSTPATH:.spec.volumes[*].hostPath.path' \ | awk '$1 !~ /^(kube-system|kube-public|kube-node-lease|cpaas-system)$/ && $3 !~ /DaemonSet/ && $4 == "<none>" && $5 !~ /^(Succeeded|Failed)$/ && $6 != "<none>" { n = split($6, p, ","); keep = 0 for (i = 1; i <= n; i++) if (p[i] !~ /^\/(dev|proc|sys|run|var\/run|var\/lib\/kubelet)(\/|$)/) keep = 1 if (keep) print }'
然后运行:
ac config use-cluster global # on the standby, instead: export KUBECONFIG=<standby-kubeconfig>bash check-global-dcs-no-preflight.sh# on the standby: unset KUBECONFIG
#!/usr/bin/env bashac whoami --show-serverKCP=$(ac -n cpaas-system get clusters.cluster.x-k8s.io global -o jsonpath='{.spec.controlPlaneRef.name}')echo "== Control plane and MachineDeployments"ac -n cpaas-system get kubeadmcontrolplane "${KCP}" -o jsonpath='replicas={.spec.replicas}{"\n"}'ac -n cpaas-system get machinedeployment -l cluster.x-k8s.io/cluster-name=global \ -o custom-columns='NAME:.metadata.name,UNAVAILABLE:.spec.strategy.rollingUpdate.maxUnavailable'echo "== Host pools and hosts"ac -n cpaas-system get machineinventorypools.infrastructure.cluster.x-k8s.io \ -o custom-columns='NAME:.metadata.name,CLUSTER:.spec.clusterName,HOSTS:.spec.machineInventories[*].name'ac -n cpaas-system get machineinventories.elemental.cattle.io \ -o custom-columns='NAME:.metadata.name,OS:.metadata.labels.os\.baremetal\.alauda\.io/id'echo "== Local, hostPath, and TopoLVM PersistentVolumes with a claim"ac get pv --no-headers \ -o custom-columns='NAME:.metadata.name,CLAIM_NAMESPACE:.spec.claimRef.namespace,CLAIM:.spec.claimRef.name,LOCAL:.spec.local.path,HOSTPATH:.spec.hostPath.path,CSI:.spec.csi.driver' \ | awk '$2 !~ /^(<none>|kube-system|kube-public|kube-node-lease|cpaas-system)$/ && ($4 != "<none>" || $5 != "<none>" || $6 ~ /^topolvm\.(io|cybozu\.com)$/)'
然后运行:
ac config use-cluster global # on the standby, instead: export KUBECONFIG=<standby-kubeconfig>bash check-global-baremetal.sh# on the standby: unset KUBECONFIG
global 的主机是其 CLUSTER 为 global 的池中 HOSTS 列出的主机,包括备用主机。在这些主机中,对于 OS 为 alaudaos.m.55、为空或为 <none>(Alauda OS M55)的主机:
#!/usr/bin/env bashac whoami --show-serverKCP=$(ac -n cpaas-system get clusters.cluster.x-k8s.io global -o jsonpath='{.spec.controlPlaneRef.name}')echo "== Rollout settings"ac -n cpaas-system get kubeadmcontrolplane "${KCP}" -o jsonpath='replicas={.spec.replicas} maxSurge={.spec.rolloutStrategy.rollingUpdate.maxSurge}{"\n"}'ac -n cpaas-system get machinedeployment -l cluster.x-k8s.io/cluster-name=global \ -o custom-columns='NAME:.metadata.name,SURGE:.spec.strategy.rollingUpdate.maxSurge'echo "== Machines"ac -n cpaas-system get baremetalmachines.infrastructure.cluster.x-k8s.io -l cluster.x-k8s.io/cluster-name=global \ -o custom-columns='NAME:.metadata.name,PHASE:.status.phase'echo "== Kubelet patch files: the encoding, then the content or a Secret name and key"echo "${KCP}:"ac -n cpaas-system get kubeadmcontrolplane "${KCP}" -o jsonpath='{range .spec.kubeadmConfigSpec.files[?(@.path=="/etc/kubernetes/patches/kubeletconfiguration0+strategic.json")]}{"encoding=["}{.encoding}{"] "}{.content}{.contentFrom.secret.name}{" "}{.contentFrom.secret.key}{"\n"}{end}'for t in $(ac -n cpaas-system get machinedeployment -l cluster.x-k8s.io/cluster-name=global -o jsonpath='{.items[*].spec.template.spec.bootstrap.configRef.name}'); do echo "${t}:" ac -n cpaas-system get kubeadmconfigtemplate "${t}" -o jsonpath='{range .spec.template.spec.files[?(@.path=="/etc/kubernetes/patches/kubeletconfiguration0+strategic.json")]}{"encoding=["}{.encoding}{"] "}{.content}{.contentFrom.secret.name}{" "}{.contentFrom.secret.key}{"\n"}{end}'doneecho "== Pods with hostPath volumes"ac get pods -A --no-headers \ -o custom-columns='NAMESPACE:.metadata.namespace,NAME:.metadata.name,OWNER:.metadata.ownerReferences[*].kind,MIRROR:.metadata.annotations.kubernetes\.io/config\.mirror,PHASE:.status.phase,HOSTPATH:.spec.volumes[*].hostPath.path' \ | awk '$1 !~ /^(kube-system|kube-public|kube-node-lease|cpaas-system)$/ && $3 !~ /DaemonSet/ && $4 == "<none>" && $5 !~ /^(Succeeded|Failed)$/ && $6 != "<none>" { n = split($6, p, ","); keep = 0 for (i = 1; i <= n; i++) if (p[i] !~ /^\/(dev|proc|sys|run|var\/run|var\/lib\/kubelet)(\/|$)/) keep = 1 if (keep) print }'
然后运行:
ac config use-cluster global # on the standby, instead: export KUBECONFIG=<standby-kubeconfig>bash check-global-baremetal-no-preflight.sh# on the standby: unset KUBECONFIG
#!/usr/bin/env bashac whoami --show-serverKCP=$(ac -n cpaas-system get clusters.cluster.x-k8s.io global -o jsonpath='{.spec.controlPlaneRef.name}')echo "== Pools of the machine templates in use"ac -n cpaas-system get hcsmachinetemplate \ $(ac -n cpaas-system get kubeadmcontrolplane "${KCP}" -o jsonpath='{.spec.machineTemplate.infrastructureRef.name}') \ $(ac -n cpaas-system get machinedeployment -l cluster.x-k8s.io/cluster-name=global -o jsonpath='{.items[*].spec.template.spec.infrastructureRef.name}') \ -o custom-columns='NAME:.metadata.name,POOL:.spec.template.spec.configPoolRef.name'ac -n cpaas-system get hcsmachineconfigpool \ -o custom-columns='NAME:.metadata.name,AVAILABLE:.status.availableCount,DISKS:.spec.configs[*].persistentDisks[*].slot,HOSTNAMES:.spec.configs[*].hostname,USED:.status.usedConfigs[*].hostname'echo "== Providers"ac get moduleinfo -l cpaas.io/cluster-name=global \ -o custom-columns='MODULE:.metadata.labels.cpaas\.io/module-name,PHASE:.status.phase' | grep -E '^MODULE|cluster-api-provider'echo "== Local, hostPath, and TopoLVM PersistentVolumes with a claim"ac get pv --no-headers \ -o custom-columns='NAME:.metadata.name,CLAIM_NAMESPACE:.spec.claimRef.namespace,CLAIM:.spec.claimRef.name,LOCAL:.spec.local.path,HOSTPATH:.spec.hostPath.path,CSI:.spec.csi.driver' \ | awk '$2 !~ /^(<none>|kube-system|kube-public|kube-node-lease|cpaas-system)$/ && ($4 != "<none>" || $5 != "<none>" || $6 ~ /^topolvm\.(io|cybozu\.com)$/)'
然后运行该脚本:
ac config use-cluster global # on the standby, instead: export KUBECONFIG=<standby-kubeconfig>bash check-global-hcs.sh# on the standby: unset KUBECONFIG
结果
操作
POOL 中所有 DISKS 列出了槽位编号的池均显示 AVAILABLE 为空、<none> 或 0
继续。
此类池显示 AVAILABLE 大于 0
使用 ac -n cpaas-system edit hcsmachineconfigpool <pool-name>,从 spec.configs 中删除其空闲配置,即 HOSTNAMES 中存在但 USED 中不存在的配置。
#!/usr/bin/env bashac whoami --show-serverKCP=$(ac -n cpaas-system get clusters.cluster.x-k8s.io global -o jsonpath='{.spec.controlPlaneRef.name}')echo "== Rollout settings"ac -n cpaas-system get kubeadmcontrolplane "${KCP}" -o jsonpath='replicas={.spec.replicas} maxSurge={.spec.rolloutStrategy.rollingUpdate.maxSurge}{"\n"}'ac -n cpaas-system get machinedeployment -l cluster.x-k8s.io/cluster-name=global \ -o custom-columns='NAME:.metadata.name,SURGE:.spec.strategy.rollingUpdate.maxSurge,UNAVAILABLE:.spec.strategy.rollingUpdate.maxUnavailable'echo "== Machine templates in use"ac -n cpaas-system get hcsmachinetemplate \ $(ac -n cpaas-system get kubeadmcontrolplane "${KCP}" -o jsonpath='{.spec.machineTemplate.infrastructureRef.name}') \ $(ac -n cpaas-system get machinedeployment -l cluster.x-k8s.io/cluster-name=global -o jsonpath='{.items[*].spec.template.spec.infrastructureRef.name}') \ -o custom-columns='NAME:.metadata.name,IMAGE:.spec.template.spec.imageName,DATA_VOLUMES:.spec.template.spec.dataVolumes[*].mountPath'echo "== Kubelet patch files: the encoding, then the content or a Secret name and key"echo "${KCP}:"ac -n cpaas-system get kubeadmcontrolplane "${KCP}" -o jsonpath='{range .spec.kubeadmConfigSpec.files[?(@.path=="/etc/kubernetes/patches/kubeletconfiguration0+strategic.json")]}{"encoding=["}{.encoding}{"] "}{.content}{.contentFrom.secret.name}{" "}{.contentFrom.secret.key}{"\n"}{end}'for t in $(ac -n cpaas-system get machinedeployment -l cluster.x-k8s.io/cluster-name=global -o jsonpath='{.items[*].spec.template.spec.bootstrap.configRef.name}'); do echo "${t}:" ac -n cpaas-system get kubeadmconfigtemplate "${t}" -o jsonpath='{range .spec.template.spec.files[?(@.path=="/etc/kubernetes/patches/kubeletconfiguration0+strategic.json")]}{"encoding=["}{.encoding}{"] "}{.content}{.contentFrom.secret.name}{" "}{.contentFrom.secret.key}{"\n"}{end}'doneecho "== Pods with hostPath volumes"ac get pods -A --no-headers \ -o custom-columns='NAMESPACE:.metadata.namespace,NAME:.metadata.name,OWNER:.metadata.ownerReferences[*].kind,MIRROR:.metadata.annotations.kubernetes\.io/config\.mirror,PHASE:.status.phase,HOSTPATH:.spec.volumes[*].hostPath.path' \ | awk '$1 !~ /^(kube-system|kube-public|kube-node-lease|cpaas-system)$/ && $3 !~ /DaemonSet/ && $4 == "<none>" && $5 !~ /^(Succeeded|Failed)$/ && $6 != "<none>" { n = split($6, p, ","); keep = 0 for (i = 1; i <= n; i++) if (p[i] !~ /^\/(dev|proc|sys|run|var\/run|var\/lib\/kubelet)(\/|$)/) keep = 1 if (keep) print }'
然后运行该脚本:
ac config use-cluster global # on the standby, instead: export KUBECONFIG=<standby-kubeconfig>bash check-global-hcs-no-preflight.sh# on the standby: unset KUBECONFIG
ac config use-cluster global # on the standby, instead: export KUBECONFIG=<standby-kubeconfig>bash check-global-vsphere.sh# on the standby: unset KUBECONFIG
#!/usr/bin/env bashac whoami --show-serverKCP=$(ac -n cpaas-system get clusters.cluster.x-k8s.io global -o jsonpath='{.spec.controlPlaneRef.name}')echo "== Rollout settings"ac -n cpaas-system get kubeadmcontrolplane "${KCP}" -o jsonpath='replicas={.spec.replicas} maxSurge={.spec.rolloutStrategy.rollingUpdate.maxSurge}{"\n"}'ac -n cpaas-system get machinedeployment -l cluster.x-k8s.io/cluster-name=global \ -o custom-columns='NAME:.metadata.name,SURGE:.spec.strategy.rollingUpdate.maxSurge,UNAVAILABLE:.spec.strategy.rollingUpdate.maxUnavailable'echo "== Machine templates in use"ac -n cpaas-system get vspheremachinetemplate \ $(ac -n cpaas-system get kubeadmcontrolplane "${KCP}" -o jsonpath='{.spec.machineTemplate.infrastructureRef.name}') \ $(ac -n cpaas-system get machinedeployment -l cluster.x-k8s.io/cluster-name=global -o jsonpath='{.items[*].spec.template.spec.infrastructureRef.name}') \ -o custom-columns='NAME:.metadata.name,VM_TEMPLATE:.spec.template.spec.template'echo "== Kubelet patch files: the encoding, then the content or a Secret name and key"echo "${KCP}:"ac -n cpaas-system get kubeadmcontrolplane "${KCP}" -o jsonpath='{range .spec.kubeadmConfigSpec.files[?(@.path=="/etc/kubernetes/patches/kubeletconfiguration0+strategic.json")]}{"encoding=["}{.encoding}{"] "}{.content}{.contentFrom.secret.name}{" "}{.contentFrom.secret.key}{"\n"}{end}'for t in $(ac -n cpaas-system get machinedeployment -l cluster.x-k8s.io/cluster-name=global -o jsonpath='{.items[*].spec.template.spec.bootstrap.configRef.name}'); do echo "${t}:" ac -n cpaas-system get kubeadmconfigtemplate "${t}" -o jsonpath='{range .spec.template.spec.files[?(@.path=="/etc/kubernetes/patches/kubeletconfiguration0+strategic.json")]}{"encoding=["}{.encoding}{"] "}{.content}{.contentFrom.secret.name}{" "}{.contentFrom.secret.key}{"\n"}{end}'doneecho "== Pods with hostPath volumes"ac get pods -A --no-headers \ -o custom-columns='NAMESPACE:.metadata.namespace,NAME:.metadata.name,OWNER:.metadata.ownerReferences[*].kind,MIRROR:.metadata.annotations.kubernetes\.io/config\.mirror,PHASE:.status.phase,HOSTPATH:.spec.volumes[*].hostPath.path' \ | awk '$1 !~ /^(kube-system|kube-public|kube-node-lease|cpaas-system)$/ && $3 !~ /DaemonSet/ && $4 == "<none>" && $5 !~ /^(Succeeded|Failed)$/ && $6 != "<none>" { n = split($6, p, ","); keep = 0 for (i = 1; i <= n; i++) if (p[i] !~ /^\/(dev|proc|sys|run|var\/run|var\/lib\/kubelet)(\/|$)/) keep = 1 if (keep) print }'
然后运行该脚本:
ac config use-cluster global # on the standby, instead: export KUBECONFIG=<standby-kubeconfig>bash check-global-vsphere-no-preflight.sh# on the standby: unset KUBECONFIG
ac config use-cluster global # on the standby, instead: export KUBECONFIG=<standby-kubeconfig>ac whoami --show-serverKCP=$(ac -n cpaas-system get clusters.cluster.x-k8s.io <cluster-name> -o jsonpath='{.spec.controlPlaneRef.name}')# The control plane, only when replicas is 3 or moreac -n cpaas-system patch kubeadmcontrolplane "${KCP}" --type merge \ -p '{"spec":{"rolloutStrategy":{"type":"RollingUpdate","rollingUpdate":{"maxSurge":0}}}}'# Each MachineDeployment to correctac -n cpaas-system patch machinedeployment <md-name> --type merge \ -p '{"spec":{"strategy":{"type":"RollingUpdate","rollingUpdate":{"maxSurge":0,"maxUnavailable":1}}}}'# on the standby: unset KUBECONFIG
ac config use-cluster global # on the standby, instead: export KUBECONFIG=<standby-kubeconfig>ac whoami --show-serverac -n cpaas-system get secret <secret-name> -o jsonpath='{.data.<secret-key>}' | base64 -d# on the standby: unset KUBECONFIG
ac config use-cluster <cluster-name> # on the standby, instead: export KUBECONFIG=<standby-kubeconfig>ac whoami --show-serverac get etcdbackupconfiguration etcd-backup-default \ -o jsonpath='{range .status.records[*]}{.backupTimestamp}{"\t"}{.result}{"\n"}{end}'ac config use-cluster global # on the standby, instead: unset KUBECONFIG
结果
操作
最新时间的记录显示 Success
继续。
命令报告 NotFound 或 the server doesn't have a resource type
仅当源 ACP 版本为 4.3 或更早版本时执行。使用上一步的 Customer Portal 登录信息下载 Upgrade from ACP 4.3 or earlier 场景:
violet ac scenarios --arch=<arch> --platformVersion=v<target-version>violet ac download-app --arch=<arch> --platformVersion=v<target-version> --scenario="Upgrade from ACP 4.3 or earlier"
# A cluster plugin: the platform distributes itviolet push <cluster-plugin-package>.tgz --platform-address "https://<platform-address>" --platform-token "${PLATFORM_TOKEN}"# An operator: global and every workload cluster that runs itviolet push <operator-package>.tgz --platform-address "https://<platform-address>" --platform-token "${PLATFORM_TOKEN}" \ --clusters "global,<cluster-name-1>,<cluster-name-2>"
仅在 DR 环境中执行。为此步骤的其余部分选择 standby,并像对 primary 一样读取其 Registry 类型:
export KUBECONFIG=<standby-kubeconfig>ac whoami --show-serverac get productbase base -o jsonpath='{.spec.registry.address}{"\t"}{.spec.registry.external}{"\n"}'
为每个正在使用的 provider 暂存目标版本以及每个中间 Kubernetes 版本的镜像。选项卡生成的命令会在 global 上运行;在 DR 中,在两个 global 集群上运行这些命令,在 standby 上于 export KUBECONFIG=<standby-kubeconfig> 之后运行,并在之后运行 unset KUBECONFIG:
ac config use-cluster global # on the standby, instead: export KUBECONFIG=<standby-kubeconfig>ac whoami --show-server
Huawei DCS
Bare Metal
Huawei Cloud Stack
VMware vSphere
将每个版本的 qcow2 镜像上传到集群使用的每个 DCS 站点,并在每个站点上将其注册为同名的 VM 模板。然后生成 VM 模板 ConfigMap,并将其应用到 global。选择要注册 VM 模板的所有架构;每个生成的 ConfigMap 都会记录其架构。注册集群使用的每种架构的 VM 模板;对于混合架构的集群,按照 VM 模板 ConfigMap 中的说明,在每个 ConfigMap 上设置 architecture。
Run the command on the global cluster. In a DR environment, run it on both global clusters: the ConfigMaps are not synchronized between them.
For each ACP version, register VM templates of only one OS per architecture on a global cluster. When VM templates of different OSes have the same Kubernetes version and architecture, an upgrade can move a cluster to the other OS.
ConfigMaps created from earlier versions of this document have no architecture key and no architecture in their name. Once the ConfigMaps of an ACP version exist for each architecture that you use, you can delete the earlier ConfigMaps of that version when no upgrade is in progress.
如果为升级路径上的某个版本注册了两种架构的 VM 模板,则还要在当前 VM 模板尚无 ConfigMap 时,注册每个集群当前运行的 VM 模板,包括 global。升级会根据节点组当前 VM 模板的 ConfigMap 确定其架构。没有该 ConfigMap 时,升级无法在两种架构之间进行选择,并会因 ImageCatalogMiss 停止。按照 VM 模板 ConfigMap 中的说明进行注册,并使用创建该 VM 模板所依据的 Alauda OS 镜像的 ACP 版本。
在执行主机上,从目标 Core Package 的 installer/ 目录中,推送每个版本存档中的两个镜像。主机在 /var/tmp 中需要至少有存档大小的可用空间;<host-arch> 是其架构,即 amd64 或 arm64。对于 Alauda OS M55,推送 baremetal-base-image 和 baremetal-base-image-iso。对于 Alauda OS KU,推送 kubeos-rootfs 和 kubeos-iso。<os-image-tag> 是不含 .tar 的存档文件名。admin 密码位于 global 的 cpaas-system/registry-admin Secret 中。在 DR 中,推送到两个 global 集群的 Registry。
read -rsp "Registry password: " REGISTRY_PASSWORD; printf '\n'# Alauda OS M55for repo in baremetal-base-image baremetal-base-image-iso; do res/<host-arch>/packtool image push <bare-metal-os-archive> \ "<registry-address>/tkestack/${repo}:<os-image-tag>" --ref "${repo}:<os-image-tag>" \ -u "<registry-username>" -p "${REGISTRY_PASSWORD}"done# Alauda OS KUfor repo in kubeos-rootfs kubeos-iso; do res/<host-arch>/packtool image push <bare-metal-os-archive> \ "<registry-address>/tkestack/${repo}:<os-image-tag>" --ref "${repo}:<os-image-tag>" \ -u "<registry-username>" -p "${REGISTRY_PASSWORD}"doneunset REGISTRY_PASSWORD
在请求升级之前,对于池中主机的每个 OS 和架构,将每个版本的密钥添加到 global 上的镜像目录中。如果主机在其密钥缺失时被替换,升级会因 ImageCatalogMiss 停止,直到你添加该密钥:
An OS image tag is the file name of its OS archive without .tar, and the tag of both images of the archive.
ac -n cpaas-system patch configmap elemental-image-catalog --type merge --patch-file /dev/stdin <<'EOF'
{
"data": {
"v1.36.4-acp.3": "tkestack/baremetal-base-image:<os-image-tag-for-v4.5.0>",
"v1.36.4-acp.3_etcd": "acp/k8s/etcd:v3.6.13-acp.5"
}
}
EOF
ac -n cpaas-system get configmap elemental-image-catalog -o yaml
The values have no registry address. When the provider installs the OS image on a host, it uses the registry of the cluster, or its registry mirror.
Run the command on the global cluster. In a DR environment, run it on both global clusters: the image catalog is not synchronized between them.
The command adds keys and keeps the existing ones. Do not remove existing keys, including those of the Kubernetes version that a cluster runs today: they are used to add nodes and to replace failed nodes.
Do not change the image catalog while an upgrade is in progress. A host replaced after the change installs the new image, so the nodes of one pool can end up on different images.
Use one Alauda OS variant per cluster. Alauda OS M55 hosts use amd64. The hosts of an Alauda OS KU cluster can mix amd64 and arm64; add the keys of every architecture that its hosts use.
该命令会在 global 上创建 ResourcePatch。不要删除它。在 global 升级之前为目标版本豁免它,并在之后的每次次要版本升级中再次豁免它,如解决预检阻塞中所述。
使用 ac -n cpaas-system get machineinventories.elemental.cattle.io -L os.baremetal.alauda.io/arch,os.baremetal.alauda.io/id 列出主机的架构和 OS 标签。主机的密钥由 Kubernetes 版本和这些标签组成;请参阅每种架构和 OS 的 OS 镜像密钥。没有这些标签的主机会解析为 amd64 和 Alauda OS M55。对于使用 Alauda OS M55 的 amd64 主机,无需执行任何操作;对于其他没有这些标签的主机,请联系技术支持。
Run the command on the global cluster. In a DR environment, run it on both global clusters: the ConfigMaps are not synchronized between them.
For each ACP version, register images of only one OS per architecture on a global cluster. When images of different OSes have the same Kubernetes version and architecture, an upgrade can move a cluster to the other OS.
ConfigMaps created from earlier versions of this document have no architecture key and no architecture in their name. Once the ConfigMaps of an ACP version exist for each architecture that you use, you can delete the earlier ConfigMaps of that version when no upgrade is in progress.
在集群使用的每个 vCenter 数据中心中,部署每个版本的 ova,并将已部署的虚拟机转换为 VM 模板。在每个数据中心使用相同的模板名称。模板必须满足 VM 模板要求。然后生成 VM 模板 ConfigMap,并按照 VM 模板 ConfigMap 中的说明,将其应用到 global。每个 VMware vSphere 集群都需要这些 ConfigMap。
Run the command on the global cluster. In a DR environment, run it on both global clusters: the ConfigMaps are not synchronized between them.
For each ACP version, register VM templates of only one OS on a global cluster. When VM templates of different OSes have the same Kubernetes version, an upgrade can move a cluster to the other OS.
ac config use-cluster global # on the standby, instead: export KUBECONFIG=<standby-kubeconfig>ac whoami --show-serverac -n cpaas-system get configmap -l cpaas.io/dcs-vm-template -L cpaas.io/dcs-vm-template,cpaas.io/distribution-version# on the standby: unset KUBECONFIG
对于目标版本和每个中间 Kubernetes 版本,当 ConfigMap 在 DISTRIBUTION-VERSION 中显示其 ACP 版本,并且在 global 使用的每个站点的 DCS 控制台中,都有一个 VM 模板的名称与其 DCS-VM-TEMPLATE 列中的名称相符时,继续执行;否则,针对该版本执行暂存 Alauda OS 镜像中的 Huawei DCS 步骤。
ac config use-cluster global # on the standby, instead: export KUBECONFIG=<standby-kubeconfig>ac whoami --show-serverac -n cpaas-system get machineinventorypools.infrastructure.cluster.x-k8s.io \ -o custom-columns='NAME:.metadata.name,CLUSTER:.spec.clusterName,HOSTS:.spec.machineInventories[*].name'ac -n cpaas-system get machineinventories.elemental.cattle.io \ -o custom-columns='NAME:.metadata.name,ARCH:.metadata.labels.os\.baremetal\.alauda\.io/arch,OS:.metadata.labels.os\.baremetal\.alauda\.io/id'ac -n cpaas-system get configmap elemental-image-catalog -o yaml# on the standby: unset KUBECONFIG
global 的主机是 CLUSTER 为 global 的资源池中 HOSTS 的主机。对于 ARCH 或 OS 为空或为 <none> 的主机,使用 amd64 或 alaudaos.m.55。对于路径上的每个 Kubernetes 版本,当目录包含键 <kubernetes-version>_etcd,并且对于 global 中每台主机的 ARCH 和 OS,包含 OS 镜像键 <kubernetes-version>_<arch>_<os-id>,或者对于具有 alaudaos.m.55 的 amd64,包含按架构和 OS 划分的 OS 镜像键中所述的裸 <kubernetes-version> 时,继续执行;否则,针对缺失的键执行暂存 Alauda OS 镜像中的 Bare Metal 步骤。
ac config use-cluster global # on the standby, instead: export KUBECONFIG=<standby-kubeconfig>ac whoami --show-serverac -n cpaas-system get configmap -l cpaas.io/hcs-vm-template -L cpaas.io/hcs-vm-template,cpaas.io/distribution-version# on the standby: unset KUBECONFIG
ac config use-cluster global # on the standby, instead: export KUBECONFIG=<standby-kubeconfig>ac whoami --show-serverac -n cpaas-system get configmap -l cpaas.io/vsphere-vm-template -L cpaas.io/vsphere-vm-template,cpaas.io/distribution-version# on the standby: unset KUBECONFIG
适用范围:每个 global 集群。在 DR 环境中,在每个 global 集群上运行。对于业务集群,跳过此检查。
在目标 Core Package 的 installer/ 目录中,在每个 global 集群上运行:
ac config use-cluster global # on the standby, instead: export KUBECONFIG=<standby-kubeconfig>ac whoami --show-serverunset REGISTRY_USERNAME REGISTRY_PASSWORDac get productmanifestsbash upgrade.sh --preflight# on the standby: unset KUBECONFIG
对于 ResourcePatchUpgradeable,与技术支持一起检查列出的每个补丁,然后在 global 集群上豁免该补丁,并将目标版本作为值;不要使用 *。在 DR 环境中,在两侧分别执行:
ac config use-cluster global # on the standby, instead: export KUBECONFIG=<standby-kubeconfig>ac whoami --show-serverac get resourcepatches \ -o custom-columns='NAME:.metadata.name,EXEMPT:.metadata.annotations.config\.cpaas\.io/exempt-for-ver'ac get resourcepatches <rp-name> -o yamlac annotate resourcepatches <rp-name> config.cpaas.io/exempt-for-ver=<target-version> --overwrite# on the standby: unset KUBECONFIG
对于 AdminAckRequired,从 admin-gates 复制密钥,记录确认信息,然后重新运行预检检查。在非 Alauda OS 上,先完成按 OS 和提供商检查的非 Alauda OS 选项卡中的节点检查。在 DR 环境中,在两侧分别执行:
ac config use-cluster global # on the standby, instead: export KUBECONFIG=<standby-kubeconfig>ac whoami --show-serverac -n cpaas-system get configmap admin-gates -o yamlACK_KEY='<key-from-admin-gates>'ac -n cpaas-system patch configmap admin-acks --type merge -p "{\"data\":{\"${ACK_KEY}\":\"true\"}}"bash upgrade.sh --preflight# on the standby: unset KUBECONFIG