全部產品
Search
文件中心

Resource Orchestration Service:ALIYUN::CS::ManagedKubernetesCluster

更新時間:Feb 06, 2026

ALIYUN::CS::ManagedKubernetesCluster類型用於建立Kubernetes託管版叢集。

文法

{
  "Type": "ALIYUN::CS::ManagedKubernetesCluster",
  "Properties": {
    "CloudMonitorFlags": Boolean,
    "ProxyMode": String,
    "SnatEntry": Boolean,
    "VpcId": String,
    "Tags": List,
    "LoginPassword": String,
    "ContainerCidr": String,
    "Name": String,
    "Taint": List,
    "KeyPair": String,
    "Addons": List,
    "ServiceCidr": String,
    "KubernetesVersion": String,
    "SecurityGroupId": String,
    "EndpointPublicAccess": Boolean,
    "RrsaConfig": Map,
    "ClusterSpec": String,
    "TimeoutMins": Number,
    "PodVswitchIds": List,
    "EncryptionProviderKey": String,
    "Runtime": Map,
    "SocEnabled": Boolean,
    "UserData": String,
    "OsType": String,
    "IsEnterpriseSecurityGroup": Boolean,
    "Platform": String,
    "LoadBalancerSpec": String,
    "FormatDisk": Boolean,
    "NodeCidrMask": String,
    "KeepInstanceName": Boolean,
    "DeletionProtection": Boolean,
    "ResourceGroupId": String,
    "NodePools": List,
    "NodeNameMode": String,
    "SecurityHardeningOs": Boolean,
    "DeleteOptions": List,
    "ControlPlaneLogComponents": List,
    "ControlPlaneLogTtl": Number,
    "ControlPlaneLogProject": String,
    "MaintenanceWindow": Map,
    "ZoneIds": List,
    "VSwitchIds": List,
    "TimeZone": String,
    "IpStack": String
  }
}

屬性

屬性名稱

類型

必須

允許更新

描述

約束

Name

String

叢集名稱。

長度為1~63個字元。可包含英文字母、漢字、數字和短劃線(-)。

VpcId

String

專用網路ID。

如果不設定,系統會自動建立專用網路,系統建立的專用網路網段為192.168.0.0/16。

VpcIdVSwitchIds只能同時為空白或者同時都設定對應的值。

Addons

List

Kubernetes叢集的Addon外掛程式的組合。

取值:

  • 網路組件

    支援Flannel和Terway兩種網路類型,建立叢集時需二選一:

    • Flannel網路:[{"Name":"flannel","Config":""}]

    • Terway網路:[{"Name": "terway-eniip","Config": ""}]

  • 儲存群組件

    支援csiflexvolume兩種類型:

    • csi:[{"Name":"csi-plugin","Config": ""},{"Name": "csi-provisioner","Config": ""}]

    • flexvolume:[{"Name": "flexvolume","Config": ""}]

  • 日誌組件(可選)

    說明

    如果不開啟Log Service,將無法使用叢集審計功能。

    • 使用已有SLS Project:[{"Name": "logtail-ds","Config": "{\"IngressDashboardEnabled\":\"true\",\"sls_project_name\":\"your_sls_project_name\"}"}]

    • 建立新的SLS Project:[{"Name": "logtail-ds","Config": "{\"IngressDashboardEnabled\":\"true\"}"}]

  • Ingress組件(可選)

    ACK專有版叢集預設安裝Ingress組件nginx-ingress-controller。

    • 安裝Ingress並且開啟公網:[{"Name":"nginx-ingress-controller","Config":"{\"IngressSlbNetworkType\":\"internet\"}"}]

    • 不安裝Ingress:[{"Name": "nginx-ingress-controller","Config": "","Disabled": true}]

  • 事件中心(可選,預設開啟)

    事件中心提供對Kubernetes事件的儲存、查詢、警示等能力。Kubernetes事件中心關聯的Logstore在90天內免費。更多資訊,請參見建立並使用K8s事件中心

    開啟事件中心:[{"Name":"ack-node-problem-detector","Config":"{\"sls_project_name\":\"your_sls_project_name\"}"}]

更多資訊,請參見Addons屬性

SecurityHardeningOs

Boolean

阿里雲作業系統安全強化。

取值:

  • true:啟用安全強化作業系統。

  • false:關閉安全強化作業系統。

預設值:false。

CloudMonitorFlags

Boolean

是否安裝CloudMonitor外掛程式。

取值:

  • true:安裝CloudMonitor外掛程式。

  • false(預設值):不安裝CloudMonitor外掛程式。

ClusterSpec

String

託管版叢集類型。

取值:

  • ack.pro.small:專業託管叢集,即ACK Pro版叢集。

  • ack.standard(預設值):標準託管叢集。

ContainerCidr

String

容器網段。

不能和專用網路網段衝突。當選擇系統自動建立專用網路時,預設使用172.16.0.0/16網段。

DeletionProtection

Boolean

是否啟用刪除保護功能。

啟用刪除保護後,叢集不能被直接刪除。取值:

  • true:啟用。

  • false(預設值):禁用。

EncryptionProviderKey

String

由Key Management Service管理的密鑰ID。

該密鑰用於加密資料磁碟。您只能在專業託管的Kubernetes叢集中使用KMS。

EndpointPublicAccess

Boolean

是否開啟公網APIServer。

取值:

  • true:開啟。

  • false(預設值):關閉。此時僅建立私網的APIServer。

FormatDisk

Boolean

是否將資料磁碟掛載到已建立的節點上,在已有的ECS執行個體中建立。

取值:

  • true:容器和鏡像的資料存放在資料磁碟上。磁碟上的未經處理資料將被覆蓋。掛載磁碟前請先備份資料。

  • false(預設值):不將容器和鏡像的資料存放區在資料磁碟上。

RrsaConfig

Map

RRSA 的配置。

更多資訊,請參考RrsaConfig屬性

IsEnterpriseSecurityGroup

Boolean

是否建立進階安全性群組。

當SecurityGroupId為空白時,該參數生效。 取值:

  • true:建立。安裝了Terway的叢集,必須建立進階安全性群組。

  • false(預設值):不建立。

KeepInstanceName

Boolean

指定是否保留叢集中使用的現有ECS執行個體的名稱。

取值:

  • true(預設值):保留。

  • false:不保留。新名稱由系統分配。

KeyPair

String

金鑰組名稱。

KeyPair和LoginPassword只能指定其中一個參數。

KubernetesVersion

String

叢集版本,與Kubernetes社區基準版本保持一致。建議選擇最新版本。

目前您可以建立兩種最新版本的叢集。關於ACK支援的Kubernetes版本,請參見【已下線】Kubernetes版本發布概覽

LoadBalancerSpec

String

Server Load Balancer執行個體規格。

取值:

  • slb.s1.small

  • slb.s2.small

  • slb.s2.medium

  • slb.s3.small

  • slb.s3.medium

  • slb.s3.large

LoginPassword

String

SSH登入密碼。

長度為8~30個字元,必須同時包含英文字母、數字和特殊字元三項,特殊字元支援( )'~!@#$%^&*-+=|{ }[ ]:;< >,.?/_

說明

LoginPassword和KeyPair只能指定其中一個參數。

NodeCidrMask

String

可分配給節點的最大IP地址數量。

數量由指定的pod CIDR決定。該參數僅在叢集使用Flannel外掛程式時生效。

預設值:25。

NodeNameMode

String

自訂節點名。

節點名稱由三部分組成:首碼+節點IP地址子串+尾碼。

  • 首碼和尾碼均可由半形句號(.)分隔的一個或多個部分組成,每個部分可以使用小寫英文字母、數字和短劃線(-),節點名稱首尾必須為小寫英文字母和數字。

  • IP位址區段長度指截取節點IP地址末尾的位元,取值範圍為5~12。

例如,節點IP地址為:192.168.XX.XX,指定首碼為aliyun.com,IP位址區段長度為5,尾碼為test,則節點名稱為aliyun.com0****test

NodePools

List

節點池資訊。

更多資訊,請參見NodePools屬性

OsType

String

作業系統類型。

取值:

  • Windows

  • Linux(預設值)

Platform

String

作業系統發布版本。

取值:

  • CentOS(預設值)

  • AliyunLinux

  • QbootAliyunLinux

  • Qboot

  • Windows

  • WindowsCore

PodVswitchIds

List

Pod交換器列表。

您需要為每一個節點交換器指定至少一個相同可用性區域的Pod交換器,該Pod交換器不能跟節點交換器重複。

建議您選擇網段掩碼不大於19的交換器。

說明

當叢集列表(Addons)取值為網路組件,且採用Terway網路類型時,必須為叢集指定PodVswitchIds。

ProxyMode

String

kube-proxy代理模式。

取值:

  • iptables(預設值)

  • ipvs

ResourceGroupId

String

叢集所屬資源群組ID。

Runtime

Map

容器運行時。

Runtime包括以下2個資訊:

  • name:容器運行時名稱。

  • version:容器運行時版本。

樣本:

{"name": "docker", "version": "19.03.5"}

關於容器運行時的選擇,請參見containerd、安全沙箱、Docker運行時的對比

更多資訊,請參見Runtime屬性

SecurityGroupId

String

叢集ECS執行個體所屬安全性群組ID。

ServiceCidr

String

服務網段。

不能和專用網路網段以及容器網段衝突。當選擇系統自動建立專用網路時,預設使用172.19.0.0/20網段。

SnatEntry

Boolean

是否為網路設定SNAT。

取值:

  • 當已有專用網路能訪問公網環境時:false。此時無需為網路設定SNAT。

  • 當已有專用網路不能訪問公網環境時:

    • true:配置SNAT,此時可以訪問公網環境。

    • false:不配置SNAT,此時不能訪問公網環境。

SocEnabled

Boolean

是否啟用基於分級保護的加固。

取值:

  • true:啟用。

  • false(預設值):禁用。

Tags

List

叢集標籤。

最多可以設定20組標籤。

更多資訊,請參見Tags屬性

Taint

List

給節點做汙點標記,通常用於Pods的調度策略。

若Pods上有相對應的容忍(tolerance)標記,則可以將容忍節點上的汙點調度到該節點。

TimeoutMins

Number

叢集建立逾時時間。

預設值:60。

單位:分鐘。

UserData

String

建立ECS執行個體時傳遞的使用者資料。

內容需要限制在16 KB以內。無需使用Base64轉碼,特殊字元需要使用轉義符。

DeleteOptions

List

叢集關聯資源的刪除選項。

更多資訊,請參見DeleteOptions屬性

ControlPlaneLogTtl

Number

控制平面組件日誌儲存天數。

ControlPlaneLogComponents

List

組件名稱列表。

指定那些控制平面的組件日誌需要被收集。

預設採集 apiserver、kcm、scheduler 組件的日誌。

ControlPlaneLogProject

String

控制平面組件Log Service Project。

可以使用已有 Project 用於日誌儲存,也可以使用系統自動建立 Project 使用者日誌儲存。如果選擇自動建立Log Service Project,將會自動建立一個名稱為k8s-log-{ClusterID}的Log Service Project。

MaintenanceWindow

Map

叢集維護視窗配置。

更多資訊,請參見MaintenanceWindow屬性

VSwitchIds

List

Worker node綁定的交換器。

ZoneIds

List

可用性區域列表。

TimeZone

String

叢集的時區。

IpStack

String

叢集的IP協議棧。

取值:

  • ipv4

  • ipv6

NodePools文法

"NodePools": [
  {
    "ScalingGroup": Map,
    "KubernetesConfig": Map,
    "NodePoolInfo": Map
  }
]

NodePools屬性

屬性名稱

類型

必須

允許更新

描述

約束

ScalingGroup

Map

節點池擴容組配置。

更多資訊,請參見ScalingGroup屬性

KubernetesConfig

Map

叢集相關配置。

更多資訊,請參見KubernetesConfig屬性

NodePoolInfo

Map

節點池配置。

更多資訊,請參見NodePoolInfo屬性

ScalingGroup文法

"ScalingGroup": {
  "InstancePatterns": List,
  "SocEnabled": Boolean,
  "ImageType": String,
  "SecurityHardeningOs": Boolean,
  "RdsInstances": List,
  "IsEnterpriseSecurityGroup": Boolean,
  "VSwitchIds": List,
  "InternetMaxBandwidthOut": Integer,
  "DataDisks": List,
  "Period": Integer,
  "InternetChargeType": String,
  "KeyPair": String,
  "SystemDiskPerformanceLevel": String,
  "ImageId": String,
  "InstanceTypes": List,
  "SystemDiskCategory": String,
  "PeriodUnit": String,
  "LoginPassword": String,
  "InstanceChargeType": String,
  "SystemDiskSize": Integer,
  "Tags": List,
  "ZoneIds": List,
  "DesiredSize": Integer
}

ScalingGroup屬性

屬性名稱

類型

必須

允許更新

描述

約束

InstanceTypes

List

執行個體規格。

SystemDiskSize

Integer

節點系統硬碟大小。

單位:GiB。

取值範圍:40~500。

VSwitchIds

List

虛擬交換器ID列表。

SocEnabled

Boolean

是否啟用基於分級保護的加固。

取值:

  • true:啟用。

  • false(預設值):禁用。

ImageType

String

作業系統鏡像類型。

InstancePatterns

List

執行個體屬性配置。

更多資訊,請參考InstancePatterns屬性

SecurityHardeningOs

Boolean

阿里雲 OS 安全強化。

取值:

  • true:開啟阿里雲 OS 安全強化。

  • false:不開啟阿里雲 OS 安全強化。

預設值:false

DesiredSize

Integer

節點池期望節點數。

DataDisks

List

節點池節點資料盤配置。

更多資訊,請參見DataDisks屬性

ImageId

String

自訂鏡像ID。

預設使用系統提供的鏡像。

InstanceChargeType

String

節點池節點付費類型。

取值:

  • PrePaid:預付費。

  • PostPaid(預設值):隨用隨付。

InternetChargeType

String

公網IP收費類型。

取值:

  • PayByBandwidth:按固定頻寬計費。

  • PayByTraffic:按使用流量計費。

InternetMaxBandwidthOut

Integer

節點公網IP出頻寬最大值。

單位:Mbps。

取值範圍:1~100。

IsEnterpriseSecurityGroup

Boolean

自動建立企業級安全性群組。

取值:

  • true:建立並使用企業級安全性群組。

  • false:不使用企業級安全性群組。

KeyPair

String

免密登入金鑰組名稱。

KeyPair和LoginPassword屬性二選一。

LoginPassword

String

SSH登入密碼。

KeyPair和LoginPassword只能選擇其中之一。

密碼規則為8~30個字元,且至少同時包含大小寫字母、數字和特殊符號。

Period

Integer

節點池節點訂用帳戶時間長度。

當InstanceChargeType取值為PrePaid時,本屬性才生效且為必選值。

當period_unit取值為Month時,period取值範圍:{ 1, 2, 3, 6, 12}。

預設值:1。

PeriodUnit

String

節點池節點付費周期。

當InstanceChargeType指定為PrePaid時需要指定周期。

Month:以月為計時單位。

RdsInstances

List

RDS執行個體ID。

SystemDiskCategory

String

節點系統硬碟類型。

取值:

  • cloud_efficiency(預設值):高效雲端硬碟。

  • cloud_ssd:SSD雲端硬碟。

  • cloud_essd:ESSD雲端硬碟。

SystemDiskPerformanceLevel

String

節點系統硬碟磁碟效能。

只對ESSD磁碟生效。

Tags

List

僅為ECS執行個體添加標籤。

更多資訊,請參見Tags屬性

ZoneIds

List

可用性區域列表。

DataDisks文法

"DataDisks": [
  {
    "AutoSnapshotPolicyId": String,
    "Encrypted": Boolean,
    "Size": Integer,
    "Category": String,
    "PerformanceLevel": String,
    "Categories": List
  }
]

DataDisks屬性

屬性名稱

類型

必須

允許更新

描述

約束

AutoSnapshotPolicyId

String

選擇自動快照策略ID。

雲端硬碟會按照快照策略自動備份。

Category

String

資料盤類型。

取值:

  • cloud:普通雲端硬碟。

  • cloud_efficiency(預設值):高效雲端硬碟。

  • cloud_ssd:SSD雲端硬碟。

  • cloud_essd:ESSD雲端硬碟。

Encrypted

Boolean

是否對資料盤加密。

取值:

  • true:對資料盤加密。

  • false(預設值):不對資料盤加密。

PerformanceLevel

String

節點資料盤磁碟效能等級。

僅對ESSD磁碟生效,磁碟效能等級和磁碟大小有關。

更多資訊,請參見ESSD雲端硬碟

Size

Integer

資料盤大小。

單位為GiB。

取值範圍:40~32768。

預設值:120。

Categories

List

資料磁碟類型的列表。

KubernetesConfig文法

"KubernetesConfig": {
  "Runtime": String,
  "RuntimeVersion": String,
  "CpuPolicy": String,
  "Labels": List,
  "NodeNameMode": String,
  "Taints": List
}

KubernetesConfig屬性

屬性名稱

類型

必須

允許更新

描述

約束

Runtime

String

容器運行時。

RuntimeVersion

String

容器運行時版本。

CpuPolicy

String

節點CPU管理原則。

當叢集版本在1.12.6及以上時支援以下兩種策略:

  • static:允許為節點上具有某些資源特徵Pod增強其CPU親和性和獨佔性。

  • none(預設值):表示啟用現有的預設CPU親和性方案。

Labels

List

節點標籤。

為Kubernetes叢集節點添加標籤。

更多資訊,請參見Labels屬性

NodeNameMode

String

自訂節點名。

節點名稱由三部分組成:首碼+節點IP地址子串+尾碼。

  • 首碼和尾碼均可由半形句號(.)分隔的一個或多個部分組成,每個部分可以使用小寫英文字母、數字和短劃線(-),節點名稱首尾必須為小寫英文字母或數字。

  • IP位址區段長度指截取節點IP地址末尾的位元,取值範圍為5~12。

例如,節點IP地址為:192.168.XX.XX,指定首碼為aliyun.com,IP位址區段長度為5,尾碼為test,則節點名稱為aliyun.com0****test

Taints

List

汙點配置。

更多資訊,請參見Taints屬性

RrsaConfig文法

"RrsaConfig": 
  {
    "Enabled": Boolean
  }

RrsaConfig屬性

屬性名稱

類型

必須

允許更新

描述

約束

Enabled

Boolean

是否啟用服務賬戶的 RAM 角色(RRSA)功能。

取值:

  • true:啟用

  • false:不啟用

InstancePatterns文法

"InstancePatterns": [
  {
    "CpuArchitectures": List,
    "MaxCpuCores": Integer,
    "MinMemorySize": Integer,
    "Memory": Integer,
    "InstanceFamilyLevel": String,
    "MinCpuCores": Integer,
    "Cores": Integer,
    "InstanceTypeFamilies": List,
    "InstanceCategories": List,
    "ExcludedInstanceTypes": List,
    "MaxMemorySize": Integer
  }
]

InstancePatterns屬性

屬性名稱

類型

必須

允許更新

描述

約束

CpuArchitectures

List

執行個體的 CPU 架構。

取值:

  • X86

  • ARM

MaxCpuCores

Integer

執行個體規格的最大 vCPU 核心數目

MinMemorySize

Integer

執行個體規格的最小記憶體。

單位:GiB。

Memory

Integer

執行個體規格的記憶體大小。

單位為 GiB。

InstanceFamilyLevel

String

執行個體規格類型系列層級。

MinCpuCores

Integer

執行個體規格的最小 vCPU 核心數目。

Cores

Integer

執行個體規格的 vCPU 核心數目。

InstanceTypeFamilies

List

指定執行個體規格類型系列。

InstanceCategories

List

執行個體分類。

ExcludedInstanceTypes

List

需要排除的執行個體規格。

MaxMemorySize

Integer

執行個體規格的最大記憶體。

單位:GiB。

Labels文法

"Labels": {
 "Value": String,
 "Key": String
}

Labels屬性

屬性名稱

類型

必須

允許更新

描述

約束

Key

String

標籤鍵。

Value

String

標籤值。

Taints文法

"Taints": [{
 "Value": String,
 "Effect": String,
 "Key": String
}]

Taints屬性

屬性名稱

類型

必須

允許更新

描述

約束

Key

String

汙點名稱。

Value

String

汙點值。

Effect

String

調度策略。

  • NoSchedule(預設值):不能容忍,但僅影響調度過程,已被調度的Pod不受影響,僅對新增加的Pod生效。

  • NoExecute:不能容忍,當汙點變動時,Pod對象會被驅逐。

  • PreferNoSchedule:柔性約束,節點現有Pod不受影響。

NodePoolInfo文法

"NodePoolInfo": {
  "Name": String,
  "Type": String,
  "ResourceGroupId": String
}

NodePoolInfo屬性

屬性名稱

類型

必須

允許更新

描述

約束

ResourceGroupId

String

節點池所屬資源群組。

Name

String

節點池名稱。

Type

String

節點池類型

取值:

  • ess: ess節點池。

  • edge:edge節點池。

MaintenanceWindow文法

"MaintenanceWindow": {
  "Enable": Boolean,
  "MaintenanceTime": String,
  "Duration": String,
  "WeeklyPeriod": String,
  "Recurrence": String
}

MaintenanceWindow屬性

屬性名稱

類型

必須

允許更新

描述

約束

Duration

String

維護時間長度。

取值範圍[1,24],單位為小時。

預設值:3h。

Enable

Boolean

是否開啟維護視窗。

取值:

  • true:開啟維護視窗。

  • false:不開啟維護視窗。

預設值:false

MaintenanceTime

String

維護起始時間。

RFC3339 標準格式。

WeeklyPeriod

String

維護周期。

多個值用英文半形逗號(,)分隔。取值:{Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday}

預設值:Thursday

Recurrence

String

使用 RFC5545 Recurrence Rule 文法定義的維護視窗迴圈規則。

目前僅支援 FREQ=WEEKLY,且不支援指定 COUNT 或 UNTIL。

Tags文法

"Tags": [
  {
    "Key": String,
    "Value": String
  }
]

Tags屬性

屬性名稱

類型

必須

允許更新

描述

約束

Key

String

標籤鍵。

長度為1~64個字元,不能以aliyunacs:https://http://開頭。

Value

String

標籤值。

長度為0~128個字元,不能以aliyunacs:https://http://開頭。

Addons文法

"Addons": [
  {
    "Version": String,
    "Config": String,
    "Name": String,
    "Disabled": Boolean
  }
]

Addons屬性

屬性名稱

類型

必須

允許更新

描述

約束

Name

String

Addon外掛程式名稱。

Config

String

Addon外掛程式配置。

Disabled

Boolean

是否禁用預設安裝。

取值:

  • true(預設值):禁用預設安裝。

  • false:啟用預設安裝。

Version

String

Addon外掛程式版本。

預設取最新版本。

DeleteOptions文法

"DeleteOptions": [
    {
      "DeleteMode": String,
      "ResourceType": String
    }
  ]

DeleteOptions屬性

屬性名稱

類型

必須

允許更新

描述

約束

DeleteMode

String

該類型資源的刪除策略。

可取值:

  • delete:刪除該類資源

  • retain:保留該類資源

ResourceType

String

資源類型。

可取值:

  • SLB:通過 service 建立的 SLB 資源,預設刪除,可選擇保留

  • ALB:ALB Ingress Controller 建立的 ALB 資源,預設保留,可選擇刪除

  • SLS_Data:叢集日誌功能所使用的Log Service Project,預設保留,可選擇刪除

  • SLS_ControlPlane:託管版叢集控制平面日誌所使用的Log Service Project,預設保留,可選擇刪除

  • PrivateZone:ACK Serverless 叢集建立的 PrivateZone 資源,預設保留,可選擇刪除

Runtime文法

"Runtime": {
    "Name": String,
    "Version": String
  }

Runtime屬性

屬性名稱

類型

必須

允許更新

描述

約束

Name

String

容器運行時名稱。

ACK 支援以下三種容器運行時。

  • containerd:推薦使用,支援所有叢集版本。

  • Sandboxed-Container.runv:安全沙箱容器,提供更高的隔離性,支援 1.24 版本及以下叢集。

  • docker:支援 1.22 版本及以下叢集。

預設值:containerd

Version

String

容器運行時版本。

預設為最新版。

關於安全沙箱運行時的變更詳情,請參見安全沙箱運行時發布記錄

傳回值

Fn::GetAtt

  • ClusterId:叢集ID。

  • TaskId:任務ID。系統自動分配,使用者查詢任務狀態。

  • DefaultUserKubeConfig:使用者配置叢集憑據的預設Kubernetes配置。

  • ScalingRuleId:伸縮規則ID。

  • ScalingGroupId:伸縮組ID。

  • PrivateUserKubConfig:使用者配置叢集憑據的專有Kubernetes配置。

  • ScalingConfigurationId:伸縮配置ID。

  • Nodes:叢集節點列表。

  • APIServerSLBId:API伺服器負載平衡ID。

  • IngressSLBId:Ingress負載平衡ID。

  • WorkerRamRoleName:Worker RAM角色名稱。

樣本

情境 1 :建立Kubernetes託管版叢集

快速建立

ROSTemplateFormatVersion: '2015-09-01'
Description: Test Create ManagedKubernetesCluster
Parameters: {}
Resources:
  Vpc:
    Type: ALIYUN::ECS::VPC
    Properties:
      VpcName: mytest
      CidrBlock: 192.168.0.0/16
  VSwitch:
    Type: ALIYUN::ECS::VSwitch
    Properties:
      VSwitchName: mytest
      VpcId:
        Ref: Vpc
      ZoneId:
        Fn::Select:
          - '0'
          - Fn::GetAZs:
              Ref: ALIYUN::Region
      CidrBlock: 192.168.1.0/24
  ManagedKubernetesCluster:
    Type: ALIYUN::CS::ManagedKubernetesCluster
    Properties:
      VSwitchIds:
        - Ref: VSwitch
      VpcId:
        Ref: Vpc
      ClusterSpec: ack.pro.small
      LoginPassword: Admin@123!
      Name: mytest
Outputs:
  ClusterId:
    Value:
      Fn::GetAtt:
        - ManagedKubernetesCluster
        - ClusterId
  TaskId:
    Value:
      Fn::GetAtt:
        - ManagedKubernetesCluster
        - TaskId         
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": "Test Create ManagedKubernetesCluster",
  "Parameters": {
  },
  "Resources": {
    "Vpc": {
      "Type": "ALIYUN::ECS::VPC",
      "Properties": {
        "VpcName": "mytest",
        "CidrBlock": "192.168.0.0/16"
      }
    },
    "VSwitch": {
      "Type": "ALIYUN::ECS::VSwitch",
      "Properties": {
        "VSwitchName": "mytest",
        "VpcId": {
          "Ref": "Vpc"
        },
        "ZoneId": {
          "Fn::Select": [
            "0",
            {
              "Fn::GetAZs": {
                "Ref": "ALIYUN::Region"
              }
            }
          ]
        },
        "CidrBlock": "192.168.1.0/24"
      }
    },
    "ManagedKubernetesCluster": {
      "Type": "ALIYUN::CS::ManagedKubernetesCluster",
      "Properties": {
        "VSwitchIds": [
          {
            "Ref": "VSwitch"
          }
        ],
        "VpcId": {
          "Ref": "Vpc"
        },
        "ClusterSpec": "ack.pro.small",
        "LoginPassword": "Admin@123!",
        "Name": "mytest"
      }
    }
  },
  "Outputs": {
    "ClusterId": {
      "Value": {
        "Fn::GetAtt": [
          "ManagedKubernetesCluster",
          "ClusterId"
        ]
      }
    },
    "TaskId": {
      "Value": {
        "Fn::GetAtt": [
          "ManagedKubernetesCluster",
          "TaskId"
        ]
      }
    }
  }
}

情境 2 :建立Kubernetes專有版叢集(已VPC)

快速建立

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 在現有VPC、交換器和安全性群組上,配置付費方式,建立Kubernetes叢集,含Worker節點、網路設定與監控外掛程式。
  en: Configure billing methods on the existing VPC, switches, and security groups, then proceed to create a Kubernetes cluster inclusive of worker nodes, network configurations, and monitoring plugins.
Parameters:
  PayType:
    Type: String
    Label:
      en: ECS Instance Charge Type
      zh-cn: 付費類型
    AssociationProperty: ChargeType
    AssociationPropertyMetadata:
      LocaleKey: InstanceChargeType
    Default: PostPaid
    AllowedValues:
      - PostPaid
      - PrePaid
  PayPeriodUnit:
    Type: String
    Label:
      en: Pay Period Unit
      zh-cn: 購買資源時間長度周期
    AssociationProperty: PayPeriodUnit
    AssociationPropertyMetadata:
      Visible:
        Condition:
          Fn::Not:
            Fn::Equals:
              - ${PayType}
              - PostPaid
    Default: Month
    AllowedValues:
      - Month
      - Year
  PayPeriod:
    Type: Number
    Label:
      en: Period
      zh-cn: 購買資源時間長度
    AssociationProperty: PayPeriod
    AssociationPropertyMetadata:
      Visible:
        Condition:
          Fn::Not:
            Fn::Equals:
              - ${PayType}
              - PostPaid
    Default: 1
    AllowedValues:
      - 1
      - 2
      - 3
      - 4
      - 5
      - 6
      - 7
      - 8
      - 9
  VpcId:
    Type: String
    Label:
      en: VPC ID
      zh-cn: Virtual Private Cloud執行個體ID
    AssociationProperty: ALIYUN::ECS::VPC::VPCId
  ZoneId:
    Type: String
    Label:
      en: Zone ID
      zh-cn: 可用性區域
    AssociationProperty: ALIYUN::ECS::Instance:ZoneId
  VSwitchId:
    Type: String
    Label:
      en: VSwitch ID
      zh-cn: 交換器執行個體ID
    AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
    AssociationPropertyMetadata:
      VpcId: ${VpcId}
      ZoneId: ${ZoneId}
  SecurityGroupId:
    Type: String
    Label:
      en: Business Security Group ID
      zh-cn: 業務安全性群組ID
    AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId
    AssociationPropertyMetadata:
      VpcId: ${VpcId}
  NumOfNodes:
    Type: Number
    Label:
      zh-cn: Worker節點數
      en: Number of Worker instances
    Default: 3
  PodCidr:
    Type: String
    Label:
      zh-cn: Pod 網路 CIDR
      en: Pod Network CIDR
    Description:
      zh-cn: 請填寫有效私人網段,即以下網段及其子網:10.0.0.0/8,172.16-31.0.0/12-16,192.168.0.0/16<br>不能與 VPC 及 VPC 內已有 Kubernetes 叢集使用的網段重複。<font color='blue'><b>建立成功後不能修改</b></font>
      en: 'Please fill in a valid private segment, i.e. the following segments and their subnets: 10.0.0.0/8, 172.16-31.0.0/12-16, 192.168.0.0/16<br> which cannot duplicate the network segments already used by clusters in VPC and VPC Kunetberes. <font color=''blue''><b>Cannot be modified after successful creation</b></font>'
    AssociationProperty: ALIYUN::CS::ManagedKubernetesCluster::PodCidr
    Default: 172.20.0.0/16
  ServiceCidr:
    Type: String
    Label:
      zh-cn: Service CIDR
      en: Service CIDR
    Description:
      zh-cn: 可選範圍:10.0.0.0/16-24,172.16-31.0.0/16-24,192.168.0.0/16-24<br>不能與 VPC 及 VPC 內已有 Kubernetes 叢集使用的網段重複。<font color='blue'><b>建立成功後不能修改</b></font>
      en: 'Optional range: 10.0.0.0/16-24, 172.16-31.0.0/16-24, 192.168.0.0/16-24<br> cannot duplicate segments already used by existing Kubernetes clusters in VPC and VPC.<font color=''blue''><b>Cannot be modified after successful creation</b></font>'
    AssociationProperty: ALIYUN::CS::ManagedKubernetesCluster::ServiceCidr
    Default: 172.21.0.0/20
  SnatEntry:
    Type: Boolean
    Label:
      zh-cn: 配置SNAT
      en: Configure SNAT
    Description:
      zh-cn: 為專用網路配置 SNAT<br>若您叢集內的節點、應用等需要訪問公網,勾選該項後我們將為您建立 NAT Gateway並自動設定 SNAT 規則。<b><a href='https://www.alibabacloud.com/help/document_detail/48126.html' target='_blank'><font color='blue'>NAT Gateway收費詳情</font></a></b>
      en: Configure SNAT for a proprietary network<br>If nodes, apps, etc. in your cluster need access to the public network, check this item and we'll create a NAT gateway for you and automatically configure the SNAT rules.<b><a href='https://www.alibabacloud.com/help/en/doc-detail/48126.html' target='_blank'><font color='blue'>NAT gateway charge details</font></a></b>
    Default: true
  EndpointPublicAccess:
    Type: Boolean
    Label:
      en: Public Access
      zh-cn: 公網訪問
    Description:
      en: Using the EIP Exposure API Server <br> creates an intranet SLB instance for API Server by default, and removing the instance will make API Server innible<br><br><font color='blue'><b>choose not to be open, you cannot access cluster API Server over an extranet</b><front>
      zh-cn: 使用 EIP 暴露 API Server<br>預設將為 API Server 建立一個內網 SLB 執行個體,若刪除該執行個體會導致 API Server 無法訪問<br><font color='blue'><b>選擇不開放時,則無法通過外網訪問叢集 API Server</b><front>
    Default: false
  CloudMonitorFlag:
    Type: Boolean
    Label:
      zh-cn: 監控外掛程式
      en: Monitor Plug-in
    Description:
      zh-cn: 在 ECS 節點上安裝CloudMonitor外掛程式
      en: Install the cloud monitoring plug-in on the ECS node .
    Default: true
  WorkerInstanceTypes:
    Type: CommaDelimitedList
    AssociationProperty: ALIYUN::ECS::Instance::InstanceType
    AssociationPropertyMetadata:
      InstanceChargeType: ${PayPeriod}
      ZoneId: ${ZoneId}
    Label:
      en: Instance Type
      zh-cn: 執行個體規格
  WorkerSystemDiskSize:
    Type: Number
    Label:
      zh-cn: Worker節點系統硬碟空間
      en: Worker System Disk Space
    Description:
      zh-cn: 系統硬碟大小, 取值範圍:[40, 500], 單位:GB。
      en: 'System disk size, range of values: 40-500, units: GB.'
    Default: 40
    MinValue: 40
    MaxValue: 500
  WorkerSystemDiskCategory:
    Type: String
    Label:
      en: Worker System Disk Category
      zh-cn: Worker節點系統硬碟類型
    AssociationPropertyMetadata:
      LocaleKey: DiskCategory
    Default: cloud_essd
    AllowedValues:
      - cloud_efficiency
      - cloud_ssd
      - cloud_essd
  LoginPassword:
    Type: String
    NoEcho: true
    Label:
      en: Instance Password
      zh-cn: 執行個體密碼
    Description:
      en: Login password, Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in)
      zh-cn: 登入密碼,長度8-30,必須包含三項(大寫字母、小寫字母、數字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符號)
    ConstraintDescription:
      en: Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in).
      zh-cn: 長度8-30,必須包含三項(大寫字母、小寫字母、數字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符號)。
    AssociationProperty: ALIYUN::ECS::Instance::Password
Resources:
  NodePools:
    Type: ALIYUN::CS::ClusterNodePool
    Properties:
      ClusterId:
        Ref: ManagedKubernetesCluster
      NodePoolInfo:
        Name: default-nodepool
      ScalingGroup:
        Period:
          Ref: PayPeriod
        PeriodUnit:
          Ref: PayPeriodUnit
        InstanceChargeType:
          Ref: PayType
        VSwitchIds:
          - Ref: VSwitchId
        ZoneIds:
          - Ref: ZoneId
        SystemDiskCategory:
          Ref: WorkerSystemDiskCategory
        SystemDiskSize:
          Ref: WorkerSystemDiskSize
        InstanceTypes:
          Ref: WorkerInstanceTypes
        LoginPassword:
          Ref: LoginPassword
        Platform: AliyunLinux
        ImageId: aliyun_3_9_x64_20G_alibase_20231219.vhd
      KubernetesConfig:
        Runtime: containerd
        RuntimeVersion: 1.6.28
      Count:
        Ref: NumOfNodes
  ManagedKubernetesCluster:
    Type: ALIYUN::CS::ManagedKubernetesCluster
    Properties:
      VpcId:
        Ref: VpcId
      VSwitchIds:
        - Ref: VSwitchId
      SecurityGroupId:
        Ref: SecurityGroupId
      ZoneIds:
        - Ref: ZoneId
      ClusterSpec: ack.pro.small
      ContainerCidr:
        Ref: PodCidr
      ServiceCidr:
        Ref: ServiceCidr
      LoginPassword:
        Ref: LoginPassword
      SnatEntry:
        Ref: SnatEntry
      Addons:
        - Name: flannel
          Config: ''
      CloudMonitorFlags:
        Ref: CloudMonitorFlag
      ProxyMode: IPVS
      EndpointPublicAccess:
        Ref: EndpointPublicAccess
      Name:
        Ref: ALIYUN::StackName
Outputs:
  ClusterId:
    Value:
      Fn::GetAtt:
        - ManagedKubernetesCluster
        - ClusterId
  TaskId:
    Value:
      Fn::GetAtt:
        - ManagedKubernetesCluster
        - TaskId
  WorkerRamRoleName:
    Value:
      Fn::GetAtt:
        - ManagedKubernetesCluster
        - WorkerRamRoleName
Metadata:
  ALIYUN::ROS::Interface:
    ParameterGroups:
      - Parameters:
          - PayType
          - PayPeriodUnit
          - PayPeriod
        Label:
          default:
            en: PayType Configuration
            zh-cn: 付費類型配置
      - Parameters:
          - VpcId
          - ZoneId
          - VSwitchId
          - SecurityGroupId
        Label:
          default:
            zh-cn: 基礎資源配置(必填)
            en: Infrastructure Configuration
      - Parameters:
          - NumOfNodes
          - PodCidr
          - ServiceCidr
          - SnatEntry
          - EndpointPublicAccess
          - CloudMonitorFlag
          - WorkerInstanceTypes
          - WorkerSystemDiskSize
          - WorkerSystemDiskCategory
          - LoginPassword
        Label:
          default:
            zh-cn: Kubernetes基本配置(必填)
            en: Kubernetes Basic Configuration
    TemplateTags:
      - acs:example:ISV軟體部署:建立Kubernetes專有版叢集(已VPC)
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "在現有VPC、交換器和安全性群組上,配置付費方式,建立Kubernetes叢集,含Worker節點、網路設定與監控外掛程式。",
    "en": "Configure billing methods on the existing VPC, switches, and security groups, then proceed to create a Kubernetes cluster inclusive of worker nodes, network configurations, and monitoring plugins."
  },
  "Parameters": {
    "PayType": {
      "Type": "String",
      "Label": {
        "en": "ECS Instance Charge Type",
        "zh-cn": "付費類型"
      },
      "AssociationProperty": "ChargeType",
      "AssociationPropertyMetadata": {
        "LocaleKey": "InstanceChargeType"
      },
      "Default": "PostPaid",
      "AllowedValues": [
        "PostPaid",
        "PrePaid"
      ]
    },
    "PayPeriodUnit": {
      "Type": "String",
      "Label": {
        "en": "Pay Period Unit",
        "zh-cn": "購買資源時間長度周期"
      },
      "AssociationProperty": "PayPeriodUnit",
      "AssociationPropertyMetadata": {
        "Visible": {
          "Condition": {
            "Fn::Not": {
              "Fn::Equals": [
                "${PayType}",
                "PostPaid"
              ]
            }
          }
        }
      },
      "Default": "Month",
      "AllowedValues": [
        "Month",
        "Year"
      ]
    },
    "PayPeriod": {
      "Type": "Number",
      "Label": {
        "en": "Period",
        "zh-cn": "購買資源時間長度"
      },
      "AssociationProperty": "PayPeriod",
      "AssociationPropertyMetadata": {
        "Visible": {
          "Condition": {
            "Fn::Not": {
              "Fn::Equals": [
                "${PayType}",
                "PostPaid"
              ]
            }
          }
        }
      },
      "Default": 1,
      "AllowedValues": [
        1,
        2,
        3,
        4,
        5,
        6,
        7,
        8,
        9
      ]
    },
    "VpcId": {
      "Type": "String",
      "Label": {
        "en": "VPC ID",
        "zh-cn": "Virtual Private Cloud執行個體ID"
      },
      "AssociationProperty": "ALIYUN::ECS::VPC::VPCId"
    },
    "ZoneId": {
      "Type": "String",
      "Label": {
        "en": "Zone ID",
        "zh-cn": "可用性區域"
      },
      "AssociationProperty": "ALIYUN::ECS::Instance:ZoneId"
    },
    "VSwitchId": {
      "Type": "String",
      "Label": {
        "en": "VSwitch ID",
        "zh-cn": "交換器執行個體ID"
      },
      "AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
      "AssociationPropertyMetadata": {
        "VpcId": "${VpcId}",
        "ZoneId": "${ZoneId}"
      }
    },
    "SecurityGroupId": {
      "Type": "String",
      "Label": {
        "en": "Business Security Group ID",
        "zh-cn": "業務安全性群組ID"
      },
      "AssociationProperty": "ALIYUN::ECS::SecurityGroup::SecurityGroupId",
      "AssociationPropertyMetadata": {
        "VpcId": "${VpcId}"
      }
    },
    "NumOfNodes": {
      "Type": "Number",
      "Label": {
        "zh-cn": "Worker節點數",
        "en": "Number of Worker instances"
      },
      "Default": 3
    },
    "PodCidr": {
      "Type": "String",
      "Label": {
        "zh-cn": "Pod 網路 CIDR",
        "en": "Pod Network CIDR"
      },
      "Description": {
        "zh-cn": "請填寫有效私人網段,即以下網段及其子網:10.0.0.0/8,172.16-31.0.0/12-16,192.168.0.0/16<br>不能與 VPC 及 VPC 內已有 Kubernetes 叢集使用的網段重複。<font color='blue'><b>建立成功後不能修改</b></font>",
        "en": "Please fill in a valid private segment, i.e. the following segments and their subnets: 10.0.0.0/8, 172.16-31.0.0/12-16, 192.168.0.0/16<br> which cannot duplicate the network segments already used by clusters in VPC and VPC Kunetberes. <font color='blue'><b>Cannot be modified after successful creation</b></font>"
      },
      "AssociationProperty": "ALIYUN::CS::ManagedKubernetesCluster::PodCidr",
      "Default": "172.20.0.0/16"
    },
    "ServiceCidr": {
      "Type": "String",
      "Label": {
        "zh-cn": "Service CIDR",
        "en": "Service CIDR"
      },
      "Description": {
        "zh-cn": "可選範圍:10.0.0.0/16-24,172.16-31.0.0/16-24,192.168.0.0/16-24<br>不能與 VPC 及 VPC 內已有 Kubernetes 叢集使用的網段重複。<font color='blue'><b>建立成功後不能修改</b></font>",
        "en": "Optional range: 10.0.0.0/16-24, 172.16-31.0.0/16-24, 192.168.0.0/16-24<br> cannot duplicate segments already used by existing Kubernetes clusters in VPC and VPC.<font color='blue'><b>Cannot be modified after successful creation</b></font>"
      },
      "AssociationProperty": "ALIYUN::CS::ManagedKubernetesCluster::ServiceCidr",
      "Default": "172.21.0.0/20"
    },
    "SnatEntry": {
      "Type": "Boolean",
      "Label": {
        "zh-cn": "配置SNAT",
        "en": "Configure SNAT"
      },
      "Description": {
        "zh-cn": "為專用網路配置 SNAT<br>若您叢集內的節點、應用等需要訪問公網,勾選該項後我們將為您建立 NAT Gateway並自動設定 SNAT 規則。<b><a href='https://www.alibabacloud.com/help/document_detail/48126.html' target='_blank'><font color='blue'>NAT Gateway收費詳情</font></a></b>",
        "en": "Configure SNAT for a proprietary network<br>If nodes, apps, etc. in your cluster need access to the public network, check this item and we'll create a NAT gateway for you and automatically configure the SNAT rules.<b><a href='https://www.alibabacloud.com/help/en/doc-detail/48126.html' target='_blank'><font color='blue'>NAT gateway charge details</font></a></b>"
      },
      "Default": true
    },
    "EndpointPublicAccess": {
      "Type": "Boolean",
      "Label": {
        "en": "Public Access",
        "zh-cn": "公網訪問"
      },
      "Description": {
        "en": "Using the EIP Exposure API Server <br> creates an intranet SLB instance for API Server by default, and removing the instance will make API Server innible<br><br><font color='blue'><b>choose not to be open, you cannot access cluster API Server over an extranet</b><front>",
        "zh-cn": "使用 EIP 暴露 API Server<br>預設將為 API Server 建立一個內網 SLB 執行個體,若刪除該執行個體會導致 API Server 無法訪問<br><font color='blue'><b>選擇不開放時,則無法通過外網訪問叢集 API Server</b><front>"
      },
      "Default": false
    },
    "CloudMonitorFlag": {
      "Type": "Boolean",
      "Label": {
        "zh-cn": "監控外掛程式",
        "en": "Monitor Plug-in"
      },
      "Description": {
        "zh-cn": "在 ECS 節點上安裝CloudMonitor外掛程式",
        "en": "Install the cloud monitoring plug-in on the ECS node ."
      },
      "Default": true
    },
    "WorkerInstanceTypes": {
      "Type": "CommaDelimitedList",
      "AssociationProperty": "ALIYUN::ECS::Instance::InstanceType",
      "AssociationPropertyMetadata": {
        "InstanceChargeType": "${PayPeriod}",
        "ZoneId": "${ZoneId}"
      },
      "Label": {
        "en": "Instance Type",
        "zh-cn": "執行個體規格"
      }
    },
    "WorkerSystemDiskSize": {
      "Type": "Number",
      "Label": {
        "zh-cn": "Worker節點系統硬碟空間",
        "en": "Worker System Disk Space"
      },
      "Description": {
        "zh-cn": "系統硬碟大小, 取值範圍:[40, 500], 單位:GB。",
        "en": "System disk size, range of values: 40-500, units: GB."
      },
      "Default": 40,
      "MinValue": 40,
      "MaxValue": 500
    },
    "WorkerSystemDiskCategory": {
      "Type": "String",
      "Label": {
        "en": "Worker System Disk Category",
        "zh-cn": "Worker節點系統硬碟類型"
      },
      "AssociationPropertyMetadata": {
        "LocaleKey": "DiskCategory"
      },
      "Default": "cloud_essd",
      "AllowedValues": [
        "cloud_efficiency",
        "cloud_ssd",
        "cloud_essd"
      ]
    },
    "LoginPassword": {
      "Type": "String",
      "NoEcho": true,
      "Label": {
        "en": "Instance Password",
        "zh-cn": "執行個體密碼"
      },
      "Description": {
        "en": "Login password, Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in)",
        "zh-cn": "登入密碼,長度8-30,必須包含三項(大寫字母、小寫字母、數字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符號)"
      },
      "ConstraintDescription": {
        "en": "Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in).",
        "zh-cn": "長度8-30,必須包含三項(大寫字母、小寫字母、數字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符號)。"
      },
      "AssociationProperty": "ALIYUN::ECS::Instance::Password"
    }
  },
  "Resources": {
    "NodePools": {
      "Type": "ALIYUN::CS::ClusterNodePool",
      "Properties": {
        "ClusterId": {
          "Ref": "ManagedKubernetesCluster"
        },
        "NodePoolInfo": {
          "Name": "default-nodepool"
        },
        "ScalingGroup": {
          "Period": {
            "Ref": "PayPeriod"
          },
          "PeriodUnit": {
            "Ref": "PayPeriodUnit"
          },
          "InstanceChargeType": {
            "Ref": "PayType"
          },
          "VSwitchIds": [
            {
              "Ref": "VSwitchId"
            }
          ],
          "ZoneIds": [
            {
              "Ref": "ZoneId"
            }
          ],
          "SystemDiskCategory": {
            "Ref": "WorkerSystemDiskCategory"
          },
          "SystemDiskSize": {
            "Ref": "WorkerSystemDiskSize"
          },
          "InstanceTypes": {
            "Ref": "WorkerInstanceTypes"
          },
          "LoginPassword": {
            "Ref": "LoginPassword"
          },
          "Platform": "AliyunLinux",
          "ImageId": "aliyun_3_9_x64_20G_alibase_20231219.vhd"
        },
        "KubernetesConfig": {
          "Runtime": "containerd",
          "RuntimeVersion": "1.6.28"
        },
        "Count": {
          "Ref": "NumOfNodes"
        }
      }
    },
    "ManagedKubernetesCluster": {
      "Type": "ALIYUN::CS::ManagedKubernetesCluster",
      "Properties": {
        "VpcId": {
          "Ref": "VpcId"
        },
        "VSwitchIds": [
          {
            "Ref": "VSwitchId"
          }
        ],
        "SecurityGroupId": {
          "Ref": "SecurityGroupId"
        },
        "ZoneIds": [
          {
            "Ref": "ZoneId"
          }
        ],
        "ClusterSpec": "ack.pro.small",
        "ContainerCidr": {
          "Ref": "PodCidr"
        },
        "ServiceCidr": {
          "Ref": "ServiceCidr"
        },
        "LoginPassword": {
          "Ref": "LoginPassword"
        },
        "SnatEntry": {
          "Ref": "SnatEntry"
        },
        "Addons": [
          {
            "Name": "flannel",
            "Config": ""
          }
        ],
        "CloudMonitorFlags": {
          "Ref": "CloudMonitorFlag"
        },
        "ProxyMode": "IPVS",
        "EndpointPublicAccess": {
          "Ref": "EndpointPublicAccess"
        },
        "Name": {
          "Ref": "ALIYUN::StackName"
        }
      }
    }
  },
  "Outputs": {
    "ClusterId": {
      "Value": {
        "Fn::GetAtt": [
          "ManagedKubernetesCluster",
          "ClusterId"
        ]
      }
    },
    "TaskId": {
      "Value": {
        "Fn::GetAtt": [
          "ManagedKubernetesCluster",
          "TaskId"
        ]
      }
    },
    "WorkerRamRoleName": {
      "Value": {
        "Fn::GetAtt": [
          "ManagedKubernetesCluster",
          "WorkerRamRoleName"
        ]
      }
    }
  },
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "ParameterGroups": [
        {
          "Parameters": [
            "PayType",
            "PayPeriodUnit",
            "PayPeriod"
          ],
          "Label": {
            "default": {
              "en": "PayType Configuration",
              "zh-cn": "付費類型配置"
            }
          }
        },
        {
          "Parameters": [
            "VpcId",
            "ZoneId",
            "VSwitchId",
            "SecurityGroupId"
          ],
          "Label": {
            "default": {
              "zh-cn": "基礎資源配置(必填)",
              "en": "Infrastructure Configuration"
            }
          }
        },
        {
          "Parameters": [
            "NumOfNodes",
            "PodCidr",
            "ServiceCidr",
            "SnatEntry",
            "EndpointPublicAccess",
            "CloudMonitorFlag",
            "WorkerInstanceTypes",
            "WorkerSystemDiskSize",
            "WorkerSystemDiskCategory",
            "LoginPassword"
          ],
          "Label": {
            "default": {
              "zh-cn": "Kubernetes基本配置(必填)",
              "en": "Kubernetes Basic Configuration"
            }
          }
        }
      ],
      "TemplateTags": [
        "acs:example:ISV軟體部署:建立Kubernetes專有版叢集(已VPC)"
      ]
    }
  }
}

情境 3 :使用ACK搭建微服務

快速建立

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 建立ACK叢集,配置VPC、安全性群組,部署微服務應用,自動調整節點池,設定ALB ingress,輸出服務訪問URL。
  en: Create an ACK (Alibaba Cloud Container Service for Kubernetes) cluster, configure
    VPC (Virtual Private Cloud) and security groups, deploy microservices applications,
    automatically scale node pools, set up ALB (Application Load Balancer) ingress,
    and output the service access URL.
Parameters:
  CommonName:
    Type: String
    Default: microservices-on-ack
  ManagedKubernetesClusterName:
    Type: String
    Label:
      en: Managed Kubernetes Cluster Name
      zh-cn: ACK託管版叢集名稱
    AssociationProperty: AutoCompleteInput
    AssociationPropertyMetadata:
      Length: 5
      Prefix: k8s-hpa-cluster-
      CharacterClasses:
        - Class: lowercase
          min: 1
  ZoneId1:
    Type: String
    AssociationProperty: 'ALIYUN::ECS::Instance::ZoneId'
    AssociationPropertyMetadata:
      ExclusiveTo:
        - ZoneId2
    Label:
      en: Availability Zone
      zh-cn: 可用性區域1
  ZoneId2:
    Type: String
    AssociationProperty: 'ALIYUN::ECS::Instance::ZoneId'
    AssociationPropertyMetadata:
      ExclusiveTo:
        - ZoneId1
    Label:
      en: Availability Zone
      zh-cn: 可用性區域2
  InstanceType:
    Type: CommaDelimitedList
    AssociationProperty: 'ALIYUN::ECS::Instance::InstanceType'
    AssociationPropertyMetadata:
      InstanceChargeType: PostPaid
      SystemDiskCategory: cloud_essd
      CreateACKClusterParams:
        NetworkPlugin: terway-eniip
    Label:
      en: Instance Type
      zh-cn: 執行個體規格
  InstancePassword:
    NoEcho: true
    Type: String
    Description:
      en: >-
        Server login password, Length 8-30, must contain three(Capital letters,
        lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special
        symbol in)
      zh-cn: >-
        伺服器登入密碼,長度8-30,必須包含三項(大寫字母、小寫字母、數字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/
        中的特殊符號)
    Label:
      en: Instance Password
      zh-cn: 執行個體密碼
    ConstraintDescription:
      en: >-
        Length 8-30, must contain three(Capital letters, lowercase letters,
        numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in)
      zh-cn: '長度8-30,必須包含三項(大寫字母、小寫字母、數字、 ()`~!@#$%^&*_-+=|{}[]:;''<>,.?/ 中的特殊符號)'
    AssociationProperty: 'ALIYUN::ECS::Instance::Password'
    Default: null
Resources:
  Vpc:
    Type: 'ALIYUN::ECS::VPC'
    Properties:
      CidrBlock: 10.0.0.0/8
      VpcName:
        Fn::Sub: ${CommonName}-vpc
  VSwitch1:
    Type: 'ALIYUN::ECS::VSwitch'
    Properties:
      VpcId:
        Ref: Vpc
      CidrBlock: 10.0.0.0/24
      ZoneId:
        Ref: ZoneId1
      VSwitchName:
        Fn::Sub: ${CommonName}-vsw
  VSwitch2:
    Type: 'ALIYUN::ECS::VSwitch'
    Properties:
      VpcId:
        Ref: Vpc
      CidrBlock: 10.0.1.0/24
      ZoneId:
        Ref: ZoneId2
      VSwitchName:
        Fn::Sub: ${CommonName}-vsw
  SecurityGroup:
    Type: 'ALIYUN::ECS::SecurityGroup'
    Properties:
      VpcId:
        Ref: Vpc
      SecurityGroupName:
        Fn::Sub: ${CommonName}-sg
      SecurityGroupIngress:
        - PortRange: 8080/8080
          SourceCidrIp: 0.0.0.0/0
          IpProtocol: tcp
        - PortRange: 80/80
          SourceCidrIp: 0.0.0.0/0
          IpProtocol: tcp
  AckCluster:
    Type: 'ALIYUN::CS::ManagedKubernetesCluster'
    Properties:
      VpcId:
        Ref: Vpc
      VSwitchIds:
        - Ref: VSwitch1
        - Ref: VSwitch2
      PodVswitchIds:
        - Ref: VSwitch1
        - Ref: VSwitch1
      Name:
        Ref: ManagedKubernetesClusterName
      KubernetesVersion: 1.33.1-aliyun.1
      ServiceCidr: 192.168.0.0/16
      ClusterSpec: ack.pro.small
      LoadBalancerSpec: slb.s2.small
      IsEnterpriseSecurityGroup: true
      SnatEntry: true
      NumOfNodes: 0
      EndpointPublicAccess: true
      Platform: AliyunLinux
      Addons:
        - Name: terway-eniip
          Config: '{"IPVlan":"false","NetworkPolicy":"false","ENITrunking":"false"}'
        - Name: csi-plugin
        - Name: csi-provisioner
        - Name: storage-operator
          Config: '{"CnfsOssEnable":"false","CnfsNasEnable":"false"}'
        - Name: logtail-ds
          Config: '{"IngressDashboardEnabled":"true"}'
        - Name: nginx-ingress-controller
          Disabled: true
        - Name: alb-ingress-controller
          Version: ""
          Config:
            Fn::Sub: >-
              {"albIngress":{"AddressType":"Internet","ZoneMappings":{"${ZoneId1}":["${VSwitch1}"],
              "${ZoneId2}":["${VSwitch2}"]},"CreateDefaultALBConfig":true}}
        - Name: ack-node-local-dns
      ProxyMode: ipvs
      DeleteOptions:
        - ResourceType: ALB
          DeleteMode: delete
        - ResourceType: SLB
          DeleteMode: delete
        - ResourceType: SLS_Data
          DeleteMode: delete
        - ResourceType: SLS_ControlPlane
          DeleteMode: delete
        - ResourceType: PrivateZone
          DeleteMode: delete
  NodePools:
    Type: 'ALIYUN::CS::ClusterNodePool'
    Properties:
      ClusterId:
        Ref: AckCluster
      NodePoolInfo:
          Name: default-nodepool
      ScalingGroup:
        InstanceChargeType: PostPaid
        VSwitchIds:
          - Ref: VSwitch1
          - Ref: VSwitch2
        ZoneIds:
          - Ref: ZoneId1
          - Ref: ZoneId2
        SystemDiskCategory: cloud_essd
        SystemDiskPerformanceLevel: PL0
        SystemDiskSize: 120
        InstanceTypes:
          Ref: InstanceType
        LoginPassword:
          Ref: InstancePassword
        Platform: AliyunLinux
        ImageId: aliyun_3_9_x64_20G_alibase_20231219.vhd
      KubernetesConfig:
        Runtime: containerd
        RuntimeVersion: 1.6.28
      Count: 3
  InstallBackendApp:
    Type: 'ALIYUN::CS::ClusterApplication'
    DependsOn: NodePools
    Properties:
      ClusterId:
        Ref: AckCluster
      YamlContent:
        Fn::Sub: |-
          apiVersion: apps/v1 # for versions before 1.8.0 use apps/v1beta1
          kind: Deployment
          metadata:
            name: ecs-ack-test-service-a
            labels:
              app: ecs-ack-test-service-a
          spec:
            replicas: 2
            selector:
              matchLabels:
                app: ecs-ack-test-service-a
            template:
              metadata:
                labels:
                  app: ecs-ack-test-service-a
              spec:
                initContainers:
                  - name: download-jar
                    image: dragonwell-registry.cn-hangzhou.cr.aliyuncs.com/dragonwell/dragonwell:8-alinux
                    command:
                      - "/bin/sh"
                      - "-c"
                      - "curl -o /app/app.jar https://help-static-aliyun-doc.aliyuncs.com/tech-solution/MicroServiceOnAckDemo-1.0.1.jar && echo 'Download jar OK!'"
                    volumeMounts:
                      - name: app-jar
                        mountPath: /app
                containers:
                  - args:
                      - '-DbHost=http://ecs-ack-test-service-b:8080'
                      - '-jar'
                      - '/app/app.jar'
                    command:
                      - java
                    name: ecs-ack-test-service-a
                    image: dragonwell-registry.cn-hangzhou.cr.aliyuncs.com/dragonwell/dragonwell:8-alinux
                    env:
                    - name: APP_MANUAL_DEPLOY
                      value: "false"
                    ports:
                      - containerPort: 8080
                    resources:
                      limits:
                        cpu: '2'
                        ephemeral-storage: 40Gi
                        memory: 2Gi
                      requests:
                        cpu: '1'
                        ephemeral-storage: 20Gi
                        memory: 1Gi
                    volumeMounts:
                      - name: app-jar
                        mountPath: /app
                volumes:
                  - name: app-jar
                    emptyDir: {}
          ---
          apiVersion: v1
          kind: Service
          metadata:
            name: ecs-ack-test-service-a
          spec:
            selector:
              app: ecs-ack-test-service-a
            ports:
              - protocol: TCP
                port: 8080
                targetPort: 8080
          ---
          apiVersion: apps/v1 # for versions before 1.8.0 use apps/v1beta1
          kind: Deployment
          metadata:
            name: ecs-ack-test-service-b
            labels:
              app: ecs-ack-test-service-b
          spec:
            replicas: 2
            selector:
              matchLabels:
                app: ecs-ack-test-service-b
            template:
              metadata:
                labels:
                  app: ecs-ack-test-service-b
              spec:
                initContainers:
                  - name: download-jar
                    image: dragonwell-registry.cn-hangzhou.cr.aliyuncs.com/dragonwell/dragonwell:8-alinux
                    command:
                      - "/bin/sh"
                      - "-c"
                      - "curl -o /app/app.jar https://help-static-aliyun-doc.aliyuncs.com/tech-solution/MicroServiceOnAckDemo-1.0.1.jar && echo 'Download jar OK!'"
                    volumeMounts:
                      - name: app-jar
                        mountPath: /app
                containers:
                  - args:
                      - '-DbHost=http://ecs-ack-test-service-b:8080'
                      - '-jar'
                      - '/app/app.jar'
                    command:
                      - java
                    name: ecs-ack-test-service-b
                    image: dragonwell-registry.cn-hangzhou.cr.aliyuncs.com/dragonwell/dragonwell:8-alinux
                    env:
                    - name: APP_MANUAL_DEPLOY
                      value: "false"
                    ports:
                      - containerPort: 8080
                    resources:
                      limits:
                        cpu: '2'
                        ephemeral-storage: 40Gi
                        memory: 2Gi
                      requests:
                        cpu: '1'
                        ephemeral-storage: 20Gi
                        memory: 1Gi
                    volumeMounts:
                      - name: app-jar
                        mountPath: /app
                volumes:
                  - name: app-jar
                    emptyDir: {}
          ---
          apiVersion: v1
          kind: Service
          metadata:
            name: ecs-ack-test-service-b
          spec:
            selector:
              app: ecs-ack-test-service-b
            ports:
              - protocol: TCP
                port: 8080
                targetPort: 8080
  AlbConfig:
    Type: 'ALIYUN::CS::ClusterApplication'
    DependsOn: InstallBackendApp
    Properties:
      ClusterId:
        Ref: AckCluster
      YamlContent:
        Fn::Sub: |-
          apiVersion: alibabacloud.com/v1
          kind: AlbConfig
          metadata:
            name: ecs-ack-test-alb-config
          spec:
            config:
              name: ecs-ack-test-alb
              addressType: Internet
              zoneMappings:
              - vSwitchId: ${VSwitch1}
              - vSwitchId: ${VSwitch2}
            listeners:
              - port: 80
                protocol: HTTP
          ---
          apiVersion: networking.k8s.io/v1
          kind: IngressClass
          metadata:
            name: ecs-ack-test-alb
          spec:
            controller: ingress.k8s.alibabacloud/alb
            parameters:
              apiGroup: alibabacloud.com
              kind: AlbConfig
              name: ecs-ack-test-alb-config
          ---
          apiVersion: networking.k8s.io/v1
          kind: Ingress
          metadata:
            name: ecs-ack-test-alb-ingress
          spec:
            ingressClassName:  ecs-ack-test-alb 
            rules:
             - http:
                paths:
                - path: /a
                  pathType: ImplementationSpecific
                  backend:
                    service:
                      name: ecs-ack-test-service-a
                      port:
                        number: 8080
                - path: /b
                  pathType: ImplementationSpecific
                  backend:
                    service:
                      name: ecs-ack-test-service-b
                      port: 
                        number: 8080
  WaitAlbIngress:
    Type: ALIYUN::ROS::Sleep
    DependsOn: AlbConfig
    Properties:
      CreateDuration: 120
  IngressInfo:
    Type: 'DATASOURCE::CS::ClusterApplicationResources'
    DependsOn: WaitAlbIngress
    Properties:
      ClusterId:
        Ref: AckCluster
      Kind: Ingress
      Namespace: default
      JsonPath: $.items.[0].status.loadBalancer.ingress.[0].hostname
      FirstMatch: true
Outputs:
  UrlServiceA:
    Description:
      zh-cn: A服務訪問地址。
      en: The addresses of A service.
    Value:
      'Fn::Sub': http://${IngressInfo}/a
  UrlServiceB:
    Description:
      zh-cn: B服務訪問地址。
      en: The addresses of B service.
    Value:
      'Fn::Sub': http://${IngressInfo}/b
Metadata:
  'ALIYUN::ROS::Interface':
    ParameterGroups:
      - Parameters:
          - SlsProjectName
          - ManagedKubernetesClusterName
          - ZoneId1
          - ZoneId2
          - InstanceType
          - InstancePassword
    TemplateTags:
      - acs:technical-solution:micro:如何快速使用ACK搭建微服務-tech_solu_124
    Hidden:
      - CommonName
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "建立ACK叢集,配置VPC、安全性群組,部署微服務應用,自動調整節點池,設定ALB ingress,輸出服務訪問URL。",
    "en": "Create an ACK (Alibaba Cloud Container Service for Kubernetes) cluster, configure VPC (Virtual Private Cloud) and security groups, deploy microservices applications, automatically scale node pools, set up ALB (Application Load Balancer) ingress, and output the service access URL."
  },
  "Parameters": {
    "CommonName": {
      "Type": "String",
      "Default": "microservices-on-ack"
    },
    "ManagedKubernetesClusterName": {
      "Type": "String",
      "Label": {
        "en": "Managed Kubernetes Cluster Name",
        "zh-cn": "ACK託管版叢集名稱"
      },
      "AssociationProperty": "AutoCompleteInput",
      "AssociationPropertyMetadata": {
        "Length": 5,
        "Prefix": "k8s-hpa-cluster-",
        "CharacterClasses": [
          {
            "Class": "lowercase",
            "min": 1
          }
        ]
      }
    },
    "ZoneId1": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::Instance::ZoneId",
      "AssociationPropertyMetadata": {
        "ExclusiveTo": [
          "ZoneId2"
        ]
      },
      "Label": {
        "en": "Availability Zone",
        "zh-cn": "可用性區域1"
      }
    },
    "ZoneId2": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::Instance::ZoneId",
      "AssociationPropertyMetadata": {
        "ExclusiveTo": [
          "ZoneId1"
        ]
      },
      "Label": {
        "en": "Availability Zone",
        "zh-cn": "可用性區域2"
      }
    },
    "InstanceType": {
      "Type": "CommaDelimitedList",
      "AssociationProperty": "ALIYUN::ECS::Instance::InstanceType",
      "AssociationPropertyMetadata": {
        "InstanceChargeType": "PostPaid",
        "SystemDiskCategory": "cloud_essd",
        "CreateACKClusterParams": {
          "NetworkPlugin": "terway-eniip"
        }
      },
      "Label": {
        "en": "Instance Type",
        "zh-cn": "執行個體規格"
      }
    },
    "InstancePassword": {
      "NoEcho": true,
      "Type": "String",
      "Description": {
        "en": "Server login password, Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in)",
        "zh-cn": "伺服器登入密碼,長度8-30,必須包含三項(大寫字母、小寫字母、數字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符號)"
      },
      "Label": {
        "en": "Instance Password",
        "zh-cn": "執行個體密碼"
      },
      "ConstraintDescription": {
        "en": "Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in)",
        "zh-cn": "長度8-30,必須包含三項(大寫字母、小寫字母、數字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符號)"
      },
      "AssociationProperty": "ALIYUN::ECS::Instance::Password",
      "Default": null
    }
  },
  "Resources": {
    "Vpc": {
      "Type": "ALIYUN::ECS::VPC",
      "Properties": {
        "CidrBlock": "10.0.0.0/8",
        "VpcName": {
          "Fn::Sub": "${CommonName}-vpc"
        }
      }
    },
    "VSwitch1": {
      "Type": "ALIYUN::ECS::VSwitch",
      "Properties": {
        "VpcId": {
          "Ref": "Vpc"
        },
        "CidrBlock": "10.0.0.0/24",
        "ZoneId": {
          "Ref": "ZoneId1"
        },
        "VSwitchName": {
          "Fn::Sub": "${CommonName}-vsw"
        }
      }
    },
    "VSwitch2": {
      "Type": "ALIYUN::ECS::VSwitch",
      "Properties": {
        "VpcId": {
          "Ref": "Vpc"
        },
        "CidrBlock": "10.0.1.0/24",
        "ZoneId": {
          "Ref": "ZoneId2"
        },
        "VSwitchName": {
          "Fn::Sub": "${CommonName}-vsw"
        }
      }
    },
    "SecurityGroup": {
      "Type": "ALIYUN::ECS::SecurityGroup",
      "Properties": {
        "VpcId": {
          "Ref": "Vpc"
        },
        "SecurityGroupName": {
          "Fn::Sub": "${CommonName}-sg"
        },
        "SecurityGroupIngress": [
          {
            "PortRange": "8080/8080",
            "SourceCidrIp": "0.0.0.0/0",
            "IpProtocol": "tcp"
          },
          {
            "PortRange": "80/80",
            "SourceCidrIp": "0.0.0.0/0",
            "IpProtocol": "tcp"
          }
        ]
      }
    },
    "AckCluster": {
      "Type": "ALIYUN::CS::ManagedKubernetesCluster",
      "Properties": {
        "VpcId": {
          "Ref": "Vpc"
        },
        "VSwitchIds": [
          {
            "Ref": "VSwitch1"
          },
          {
            "Ref": "VSwitch2"
          }
        ],
        "PodVswitchIds": [
          {
            "Ref": "VSwitch1"
          },
          {
            "Ref": "VSwitch1"
          }
        ],
        "Name": {
          "Ref": "ManagedKubernetesClusterName"
        },
        "KubernetesVersion": "1.33.1-aliyun.1",
        "ServiceCidr": "192.168.0.0/16",
        "ClusterSpec": "ack.pro.small",
        "LoadBalancerSpec": "slb.s2.small",
        "IsEnterpriseSecurityGroup": true,
        "SnatEntry": true,
        "NumOfNodes": 0,
        "EndpointPublicAccess": true,
        "Platform": "AliyunLinux",
        "Addons": [
          {
            "Name": "terway-eniip",
            "Config": "{\"IPVlan\":\"false\",\"NetworkPolicy\":\"false\",\"ENITrunking\":\"false\"}"
          },
          {
            "Name": "csi-plugin"
          },
          {
            "Name": "csi-provisioner"
          },
          {
            "Name": "storage-operator",
            "Config": "{\"CnfsOssEnable\":\"false\",\"CnfsNasEnable\":\"false\"}"
          },
          {
            "Name": "logtail-ds",
            "Config": "{\"IngressDashboardEnabled\":\"true\"}"
          },
          {
            "Name": "nginx-ingress-controller",
            "Disabled": true
          },
          {
            "Name": "alb-ingress-controller",
            "Version": "",
            "Config": {
              "Fn::Sub": "{\"albIngress\":{\"AddressType\":\"Internet\",\"ZoneMappings\":{\"${ZoneId1}\":[\"${VSwitch1}\"], \"${ZoneId2}\":[\"${VSwitch2}\"]},\"CreateDefaultALBConfig\":true}}"
            }
          },
          {
            "Name": "ack-node-local-dns"
          }
        ],
        "ProxyMode": "ipvs",
        "DeleteOptions": [
          {
            "ResourceType": "ALB",
            "DeleteMode": "delete"
          },
          {
            "ResourceType": "SLB",
            "DeleteMode": "delete"
          },
          {
            "ResourceType": "SLS_Data",
            "DeleteMode": "delete"
          },
          {
            "ResourceType": "SLS_ControlPlane",
            "DeleteMode": "delete"
          },
          {
            "ResourceType": "PrivateZone",
            "DeleteMode": "delete"
          }
        ]
      }
    },
    "NodePools": {
      "Type": "ALIYUN::CS::ClusterNodePool",
      "Properties": {
        "ClusterId": {
          "Ref": "AckCluster"
        },
        "NodePoolInfo": {
          "Name": "default-nodepool"
        },
        "ScalingGroup": {
          "InstanceChargeType": "PostPaid",
          "VSwitchIds": [
            {
              "Ref": "VSwitch1"
            },
            {
              "Ref": "VSwitch2"
            }
          ],
          "ZoneIds": [
            {
              "Ref": "ZoneId1"
            },
            {
              "Ref": "ZoneId2"
            }
          ],
          "SystemDiskCategory": "cloud_essd",
          "SystemDiskPerformanceLevel": "PL0",
          "SystemDiskSize": 120,
          "InstanceTypes": {
            "Ref": "InstanceType"
          },
          "LoginPassword": {
            "Ref": "InstancePassword"
          },
          "Platform": "AliyunLinux",
          "ImageId": "aliyun_3_9_x64_20G_alibase_20231219.vhd"
        },
        "KubernetesConfig": {
          "Runtime": "containerd",
          "RuntimeVersion": "1.6.28"
        },
        "Count": 3
      }
    },
    "InstallBackendApp": {
      "Type": "ALIYUN::CS::ClusterApplication",
      "DependsOn": "NodePools",
      "Properties": {
        "ClusterId": {
          "Ref": "AckCluster"
        },
        "YamlContent": {
          "Fn::Sub": "apiVersion: apps/v1 # for versions before 1.8.0 use apps/v1beta1\nkind: Deployment\nmetadata:\n  name: ecs-ack-test-service-a\n  labels:\n    app: ecs-ack-test-service-a\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: ecs-ack-test-service-a\n  template:\n    metadata:\n      labels:\n        app: ecs-ack-test-service-a\n    spec:\n      initContainers:\n        - name: download-jar\n          image: dragonwell-registry.cn-hangzhou.cr.aliyuncs.com/dragonwell/dragonwell:8-alinux\n          command:\n            - \"/bin/sh\"\n            - \"-c\"\n            - \"curl -o /app/app.jar https://help-static-aliyun-doc.aliyuncs.com/tech-solution/MicroServiceOnAckDemo-1.0.1.jar && echo 'Download jar OK!'\"\n          volumeMounts:\n            - name: app-jar\n              mountPath: /app\n      containers:\n        - args:\n            - '-DbHost=http://ecs-ack-test-service-b:8080'\n            - '-jar'\n            - '/app/app.jar'\n          command:\n            - java\n          name: ecs-ack-test-service-a\n          image: dragonwell-registry.cn-hangzhou.cr.aliyuncs.com/dragonwell/dragonwell:8-alinux\n          env:\n          - name: APP_MANUAL_DEPLOY\n            value: \"false\"\n          ports:\n            - containerPort: 8080\n          resources:\n            limits:\n              cpu: '2'\n              ephemeral-storage: 40Gi\n              memory: 2Gi\n            requests:\n              cpu: '1'\n              ephemeral-storage: 20Gi\n              memory: 1Gi\n          volumeMounts:\n            - name: app-jar\n              mountPath: /app\n      volumes:\n        - name: app-jar\n          emptyDir: {}\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: ecs-ack-test-service-a\nspec:\n  selector:\n    app: ecs-ack-test-service-a\n  ports:\n    - protocol: TCP\n      port: 8080\n      targetPort: 8080\n---\napiVersion: apps/v1 # for versions before 1.8.0 use apps/v1beta1\nkind: Deployment\nmetadata:\n  name: ecs-ack-test-service-b\n  labels:\n    app: ecs-ack-test-service-b\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: ecs-ack-test-service-b\n  template:\n    metadata:\n      labels:\n        app: ecs-ack-test-service-b\n    spec:\n      initContainers:\n        - name: download-jar\n          image: dragonwell-registry.cn-hangzhou.cr.aliyuncs.com/dragonwell/dragonwell:8-alinux\n          command:\n            - \"/bin/sh\"\n            - \"-c\"\n            - \"curl -o /app/app.jar https://help-static-aliyun-doc.aliyuncs.com/tech-solution/MicroServiceOnAckDemo-1.0.1.jar && echo 'Download jar OK!'\"\n          volumeMounts:\n            - name: app-jar\n              mountPath: /app\n      containers:\n        - args:\n            - '-DbHost=http://ecs-ack-test-service-b:8080'\n            - '-jar'\n            - '/app/app.jar'\n          command:\n            - java\n          name: ecs-ack-test-service-b\n          image: dragonwell-registry.cn-hangzhou.cr.aliyuncs.com/dragonwell/dragonwell:8-alinux\n          env:\n          - name: APP_MANUAL_DEPLOY\n            value: \"false\"\n          ports:\n            - containerPort: 8080\n          resources:\n            limits:\n              cpu: '2'\n              ephemeral-storage: 40Gi\n              memory: 2Gi\n            requests:\n              cpu: '1'\n              ephemeral-storage: 20Gi\n              memory: 1Gi\n          volumeMounts:\n            - name: app-jar\n              mountPath: /app\n      volumes:\n        - name: app-jar\n          emptyDir: {}\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: ecs-ack-test-service-b\nspec:\n  selector:\n    app: ecs-ack-test-service-b\n  ports:\n    - protocol: TCP\n      port: 8080\n      targetPort: 8080"
        }
      }
    },
    "AlbConfig": {
      "Type": "ALIYUN::CS::ClusterApplication",
      "DependsOn": "InstallBackendApp",
      "Properties": {
        "ClusterId": {
          "Ref": "AckCluster"
        },
        "YamlContent": {
          "Fn::Sub": "apiVersion: alibabacloud.com/v1\nkind: AlbConfig\nmetadata:\n  name: ecs-ack-test-alb-config\nspec:\n  config:\n    name: ecs-ack-test-alb\n    addressType: Internet\n    zoneMappings:\n    - vSwitchId: ${VSwitch1}\n    - vSwitchId: ${VSwitch2}\n  listeners:\n    - port: 80\n      protocol: HTTP\n---\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: ecs-ack-test-alb\nspec:\n  controller: ingress.k8s.alibabacloud/alb\n  parameters:\n    apiGroup: alibabacloud.com\n    kind: AlbConfig\n    name: ecs-ack-test-alb-config\n---\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: ecs-ack-test-alb-ingress\nspec:\n  ingressClassName:  ecs-ack-test-alb \n  rules:\n   - http:\n      paths:\n      - path: /a\n        pathType: ImplementationSpecific\n        backend:\n          service:\n            name: ecs-ack-test-service-a\n            port:\n              number: 8080\n      - path: /b\n        pathType: ImplementationSpecific\n        backend:\n          service:\n            name: ecs-ack-test-service-b\n            port: \n              number: 8080"
        }
      }
    },
    "WaitAlbIngress": {
      "Type": "ALIYUN::ROS::Sleep",
      "DependsOn": "AlbConfig",
      "Properties": {
        "CreateDuration": 120
      }
    },
    "IngressInfo": {
      "Type": "DATASOURCE::CS::ClusterApplicationResources",
      "DependsOn": "WaitAlbIngress",
      "Properties": {
        "ClusterId": {
          "Ref": "AckCluster"
        },
        "Kind": "Ingress",
        "Namespace": "default",
        "JsonPath": "$.items.[0].status.loadBalancer.ingress.[0].hostname",
        "FirstMatch": true
      }
    }
  },
  "Outputs": {
    "UrlServiceA": {
      "Description": {
        "zh-cn": "A服務訪問地址。",
        "en": "The addresses of A service."
      },
      "Value": {
        "Fn::Sub": "http://${IngressInfo}/a"
      }
    },
    "UrlServiceB": {
      "Description": {
        "zh-cn": "B服務訪問地址。",
        "en": "The addresses of B service."
      },
      "Value": {
        "Fn::Sub": "http://${IngressInfo}/b"
      }
    }
  },
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "ParameterGroups": [
        {
          "Parameters": [
            "SlsProjectName",
            "ManagedKubernetesClusterName",
            "ZoneId1",
            "ZoneId2",
            "InstanceType",
            "InstancePassword"
          ]
        }
      ],
      "TemplateTags": [
        "acs:technical-solution:micro:如何快速使用ACK搭建微服務-tech_solu_124"
      ],
      "Hidden": [
        "CommonName"
      ]
    }
  }
}

更多樣本,請參考包含此資源的公用模板