通过公共参数获取KubernetesVersion

公共参数结构

集群类型:

  • Kubernetes: ACK 专有版集群。

  • ManagedKubernetes:ACK 托管版集群,包括 ACK Pro 版集群、ACK 基础版集群、ACK Serverless Pro 版集群、ACK Serverless 基础版集群、ACK Edge Pro 版集群、ACK Edge 基础版。

  • ExternalKubernetes:ACK 注册集群。

参数示例

  • aliyun/services/cs/Kubernetes/KubernetesVersion/latest -- Kubernetes类型集群最新的小迭代版本号

  • aliyun/services/cs/ManagedKubernetes/KubernetesVersion/latest -- ManagedKubernetes类型集群最新的小迭代版本号

  • aliyun/services/cs/ExternalKubernetes/KubernetesVersion/latest -- ExternalKubernetes类型集群最新的小迭代版本号

  • aliyun/services/cs/Kubernetes/KubernetesVersion/1.28_latest -- Kubernetes类型集群1.28版本最新的小迭代版本号

  • aliyun/services/cs/ManagedKubernetes/KubernetesVersion/1.28_latest -- ManagedKubernetes类型集群1.28版本最新的小迭代版本号

  • aliyun/services/cs/ExternalKubernetes/KubernetesVersion/1.28_latest -- ExternalKubernetes类型集群1.28版本最新的小迭代版本号

获取KubernetesVersion公共参数

获取支持的Kubernetes版本

如果想获取aliyun/services/cs/Kubernetes/KubernetesVersion/下所有版本,运行以下命令,其他两种集群类似。

aliyun oos GetParametersByPath --Path aliyun/services/cs/Kubernetes/KubernetesVersion/

返回:

{
        "MaxResults": 10,
        "Parameters": [
                {
                        "CreatedBy": "ACS",
                        "CreatedDate": "2024-06-06T08:16:16Z",
                        "Description": "",
                        "Id": "p-4e5902704fd14899aa37",
                        "Name": "aliyun/services/cs/Kubernetes/KubernetesVersion/1.26_latest",
                        "ParameterVersion": 1,
                        "ShareType": "Public",
                        "Tags": {},
                        "Type": "String",
                        "UpdatedBy": "ACS",
                        "UpdatedDate": "2024-06-07T06:31:06Z",
                        "Value": "1.26.15-aliyun.1"
                },
                {
                        "CreatedBy": "ACS",
                        "CreatedDate": "2024-06-06T08:16:16Z",
                        "Description": "",
                        "Id": "p-c5ed8cee6dc243ccbb09",
                        "Name": "aliyun/services/cs/Kubernetes/KubernetesVersion/1.28_latest",
                        "ParameterVersion": 1,
                        "ShareType": "Public",
                        "Tags": {},
                        "Type": "String",
                        "UpdatedBy": "ACS",
                        "UpdatedDate": "2024-06-07T06:31:05Z",
                        "Value": "1.28.9-aliyun.1"
                },
                {
                        "CreatedBy": "ACS",
                        "CreatedDate": "2024-06-06T08:16:16Z",
                        "Description": "",
                        "Id": "p-77a81957a6b64b5a80cb",
                        "Name": "aliyun/services/cs/Kubernetes/KubernetesVersion/1.30_latest",
                        "ParameterVersion": 1,
                        "ShareType": "Public",
                        "Tags": {},
                        "Type": "String",
                        "UpdatedBy": "ACS",
                        "UpdatedDate": "2024-06-07T06:31:05Z",
                        "Value": "1.30.1-aliyun.1"
                },
                {
                        "CreatedBy": "ACS",
                        "CreatedDate": "2024-06-04T08:40:49Z",
                        "Description": "",
                        "Id": "p-5b0650fe37e649d1bc17",
                        "Name": "aliyun/services/cs/Kubernetes/KubernetesVersion/latest",
                        "ParameterVersion": 1,
                        "ShareType": "Public",
                        "Tags": {},
                        "Type": "String",
                        "UpdatedBy": "ACS",
                        "UpdatedDate": "2024-06-07T06:31:05Z",
                        "Value": "1.30.1-aliyun.1"
                }
        ],
        "RequestId": "96849C42-865E-5927-A776-F2AAF74C89AE"
}

获取支持的ManagedKubernetes版本详情

如果想获取aliyun/services/cs/ManagedKubernetes/KubernetesVersion/1.28_latest的详情,运行以下命令,其他版本类似。

aliyun oos GetParameter --Name aliyun/services/cs/ManagedKubernetes/KubernetesVersion/1.28_latest

返回:

{
        "Parameter": {
                "CreatedBy": "ACS",
                "CreatedDate": "2024-06-06T08:16:15Z",
                "Description": "",
                "Id": "p-971e193e5155482eb3c3",
                "Name": "aliyun/services/cs/ManagedKubernetes/KubernetesVersion/1.28_latest",
                "ParameterVersion": 1,
                "ShareType": "Public",
                "Tags": {},
                "Type": "String",
                "UpdatedBy": "ACS",
                "UpdatedDate": "2024-06-07T06:31:04Z",
                "Value": "1.28.9-aliyun.1"
        },
        "RequestId": "4A87871B-FBB3-5646-A2FE-7E54EDA07AAA"
}

ROS使用示例

在ACK资源中引用ManagedKubernetes 1.28版本最新的小迭代版本号:

ROSTemplateFormatVersion: '2015-09-01'
Description: Test Create ManagedKubernetesCluster
Parameters: {}
Resources:
  ManagedKubernetesCluster:
    Type: ALIYUN::CS::ManagedKubernetesCluster
    Properties:
      VSwitchIds: vsw-001
      VpcId: vpc-001
      ClusterSpec: ack.pro.small
      KubernetesVersion: '{{resolve:oos:aliyun/services/cs/ManagedKubernetes/KubernetesVersion/1.28_latest}}'
      WorkerInstanceTypes:
        - ecs.c5.large
      WorkerSystemDiskCategory: cloud_essd
      LoginPassword: Admin@123!
      Name: mytest
Outputs:
  ClusterId:
    Value:
      Fn::GetAtt:
        - ManagedKubernetesCluster
        - ClusterId