升級叢集時,系統會自動校正ECI Platform Version和Kubernetes的相容情況,對於ECI Platform Version和目標Kubernetes版本不相容的ECI Pod,需要手動刪除重建ECI Pod後,才能升級叢集的Kubernetes版本。升級叢集前,請確保ECI Platform Version與Kubernetes版本相容。
ECI Platform Version介紹
ECI Platform Version表示ECI(Elastic Container Instance)基礎設施的特定運行時環境的版本號碼,可以區分不同的ECI運行時環境。隨著ECI運行時環境的迭代,例如添加新功能、修複Bug或更新補丁,將會發布新的ECI Platform Version修訂版。
您在ACK叢集建立的ECI Pod預設會帶有一個Key為k8s.aliyun.com/eci-platform-version的Annotation,Value即為ECI Platform Version的版本號碼。Annotation樣本如下:
apiVersion: v1
kind: Pod
metadata:
annotations:
k8s.aliyun.com/eci-platform-version: 1.0.0
name: demo-76d8d9f9d8-l7pwm
namespace: default
...ECI Platform Version相容的Kubernetes版本
如下所示,不同版本的ECI Platform Version相容的Kubernetes版本有所不同。
新建立ECI Pod的ECI Platform Version版本為1.1.0,存量ECI Pod的ECI Platform Version版本為1.0.0或者為空白。
ECI Platform Version版本 | 相容的Kubernetes版本 |
1.1.0 | 1.12及以上版本 |
1.0.0 | 1.12、1.14、1.16、1.18、1.20、1.22、1.24 |
空 ( | 1.12、1.14、1.16、1.18、1.20、1.22、1.24 |
升級ECI Platform Version
串連叢集。具體操作,請參見已擷取叢集KubeConfig並通過kubectl工具串連叢集。
擷取版本號碼為空白或為1.0.0的ECI Pod的資訊。
擷取的資訊包括ECI Pod的命名空間、名稱、ECI Platform Version和ECI執行個體ID,並將這些資訊以英文半形逗號(,)分隔的格式展示。
kubectl get pods -A -o json | jq -r '.items[] | select(.metadata.annotations["k8s.aliyun.com/eci-platform-version"] == "1.0.0" or .metadata.annotations["k8s.aliyun.com/eci-platform-version"] == null or .metadata.annotations["k8s.aliyun.com/eci-platform-version"] == "") | select(.spec.nodeName | startswith("virtual-kubelet")) | "\(.metadata.namespace),\(.metadata.name),\(.metadata.annotations["k8s.aliyun.com/eci-platform-version"] // ""),\(.metadata.annotations["k8s.aliyun.com/eci-instance-id"])"'返回樣本如下:
default,portal-server-57dfc4fdc8-2gl64,,eci-2zecdr8z5jy******刪除重建目標ECI Pod。
命令樣本如下:
kubectl delete pod portal-server-57dfc4fdc8-2gl64 -n default返回樣本如下:
pod "portal-server-57dfc4fdc8-2gl64" deletedECI Pod刪除重建後,建立的ECI Pod的ECI Platform Version版本會自動升級為更新後的版本。您可以執行以下命令,查看ECI Platform Version版本。
kubectl get pods -A -o json | jq -r '.items[] | select(.spec.nodeName | startswith("virtual-kubelet")) | "\(.metadata.namespace),\(.metadata.name),\(.metadata.annotations["k8s.aliyun.com/eci-platform-version"] // ""),\(.metadata.annotations["k8s.aliyun.com/eci-instance-id"] // "")"'