ALIYUN::CS::ClusterNodePool リソースタイプは、クラスターのノードプールを作成します。
構文
{
"Type": "ALIYUN::CS::ClusterNodePool",
"Properties": {
"TeeConfig": Map,
"ClusterId": String,
"NodePoolInfo": Map,
"KubernetesConfig": Map,
"Count": Integer,
"Management": Map,
"AutoScaling": Map,
"ScalingGroup": Map
}
}プロパティ
プロパティ名 | タイプ | 必須 | 更新が許可されているか | 説明 | 制約 |
ClusterId | String | はい | いいえ | クラスターの ID。 | DescribeClustersV1 を呼び出してクラスター ID をクエリできます。 |
ScalingGroup | Map | はい | はい | ノードプールのスケーリンググループ構成。 | DescribeClusterNodePools を呼び出して、ノードプールのスケーリンググループ構成をクエリできます。 詳細については、「ScalingGroup の構文」および「ScalingGroup のプロパティ」をご参照ください。 |
AutoScaling | Map | いいえ | いいえ | オートスケーリング構成。 | 詳細については、「AutoScaling の構文」および「AutoScaling のプロパティ」をご参照ください。 |
Count | Integer | いいえ | はい | ノードプール内のノード数。 | なし |
KubernetesConfig | Map | いいえ | はい | クラスター構成。 | 詳細については、「KubernetesConfig の構文」および「KubernetesConfig のプロパティ」をご参照ください。 |
Management | Map | いいえ | いいえ | マネージドノードプールの構成。 | 詳細については、「Management の構文」および「Management のプロパティ」をご参照ください。 |
NodePoolInfo | Map | いいえ | いいえ | ノードプールの構成。 | 詳細については、「NodePoolInfo の構文」および「NodePoolInfo のプロパティ」をご参照ください。 |
TeeConfig | Map | いいえ | いいえ | 機密計算用 Kubernetes クラスターの構成。 | 詳細については、「TeeConfig の構文」および「TeeConfig のプロパティ」をご参照ください。 |
TeeConfig の構文
"TeeConfig": {
"TeeEnable": Boolean
}TeeConfig のプロパティ
プロパティ名 | タイプ | 必須 | 更新許可 | 説明 | 制約 |
TeeEnable | ブール値 | はい | いいえ | 機密計算用 Kubernetes クラスターを有効にするかどうかを指定します。 | 有効な値:
|
NodePoolInfo の構文
"NodePoolInfo": {
"ResourceGroupId": String,
"Name": String
}NodePoolInfo のプロパティ
プロパティ名 | タイプ | 必須 | 更新可能 | 説明 | 制約 |
Name | String | はい | いいえ | ノードプールの名前。 | なし |
ResourceGroupId | String | いいえ | いいえ | ノードプールが属するリソースグループの ID。 | なし |
KubernetesConfig の構文
"KubernetesConfig": {
"CpuPolicy": String,
"Runtime": String,
"CmsEnabled": Boolean,
"UserData": String,
"NodeNameMode": String,
"RuntimeVersion": String,
"Labels": List,
"Unschedulable": Boolean,
"Taints": List
}KubernetesConfig のプロパティ
プロパティ名 | タイプ | 必須 | 更新可能 | 説明 | 制約 |
Runtime | String | はい | はい | コンテナーランタイムの名前。 | なし |
RuntimeVersion | String | はい | はい | コンテナーランタイムのバージョン。 | なし |
CpuPolicy | String | いいえ | はい | ノードの CPU 管理ポリシー。 | このプロパティは、クラスターバージョンが 1.12.6 以降の場合、次のポリシーをサポートします:
|
CmsEnabled | ブール値 | いいえ | はい | ECS ノードに Cloud Monitor をインストールするかどうかを指定します。 | Cloud Monitor をインストールすると、作成された ECS インスタンスのモニタリングメトリックを Cloud Monitor コンソールで表示できます。この機能を有効にすることを推奨します。 有効な値:
|
NodeNameMode | String | いいえ | いいえ | カスタムノード名。 | ノード名は、プレフィックス + ノード IP アドレスの部分文字列 + サフィックスの 3 つの部分で構成されます。
|
Labels | List | いいえ | はい | Kubernetes クラスターノードのラベル。 | 詳細については、「Labels の構文」および「Labels のプロパティ」をご参照ください。 |
UserData | String | いいえ | はい | ノードのカスタムデータ。 | なし |
Unschedulable | ブール値 | いいえ | はい | 新しく追加されたノードをスケジュールするかどうかを指定します。 | 有効な値:
|
Taints | List | いいえ | いいえ | Taint の構成。 | 詳細については、「Taints の構文」および「Taints のプロパティ」をご参照ください。 |
Labels の構文
"Labels": [
{
"Value": String,
"Key": String
}
]Labels のプロパティ
プロパティ名 | タイプ | 必須 | 更新許可済み | 説明 | 制約 |
Value | String | はい | はい | タグの値。 | なし |
Key | String | はい | はい | タグのキー。 | なし |
Taints の構文
"Taints": [
{
"Value": String,
"Effect": String,
"Key": String
}
]Taints のプロパティ
プロパティ名 | タイプ | 必須 | 更新が許可されているか | 説明 | 制約 |
Value | String | はい | いいえ | Taint の値。 | なし |
Key | String | はい | いいえ | Taint の名前。 | なし |
Effect | String | いいえ | いいえ | スケジューリングポリシー。 | 有効な値:
|
Management の構文
"Management": {
"UpgradeConfig": Map,
"AutoRepair": Boolean,
"Enable": Boolean
}Management のプロパティ
プロパティ名 | タイプ | 必須 | 更新許可 | 説明 | 制約 |
Enable | ブール値 | はい | いいえ | マネージドノードプールを有効にするかどうかを指定します。 | 有効な値:
|
AutoRepair | ブール値 | いいえ | いいえ | 自動修復を有効にするかどうかを指定します。 | このパラメーターは、Enable が true に設定されている場合にのみ有効です。 有効な値:
|
UpgradeConfig | Map | いいえ | いいえ | 自動アップグレードの構成。 | このプロパティは、Enable が true に設定されている場合にのみ有効です。 詳細については、「UpgradeConfig の構文」および「UpgradeConfig のプロパティ」をご参照ください。 |
UpgradeConfig の構文
"UpgradeConfig": {
"AutoUpgrade": Boolean,
"SurgePercentage": Integer,
"Surge": Integer,
"MaxUnavailable": Integer
}UpgradeConfig のプロパティ
プロパティ名 | タイプ | 必須 | 更新許可 | 説明 | 制約 |
AutoUpgrade | ブール値 | いいえ | いいえ | 自動アップグレードを有効にするかどうかを指定します。 | 有効な値:
|
SurgePercentage | Integer | いいえ | いいえ | 追加ノードの割合。 | SurgePercentage または Surge のいずれかを指定できますが、両方は指定できません。 |
Surge | Integer | いいえ | いいえ | 追加ノードの数。 | SurgePercentage または Surge のいずれかを指定できますが、両方は指定できません。 |
MaxUnavailable | Integer | いいえ | いいえ | 利用不可能なノードの最大数。 | 有効な値:1〜1000。デフォルト値:1。 |
AutoScaling の構文
"AutoScaling": {
"EipBandwidth": Integer,
"Type": String,
"IsBondEip": Boolean,
"MinInstances": Integer,
"Enable": Boolean,
"MaxInstances": Integer,
"EipInternetChargeType": String
}AutoScaling のプロパティ
プロパティ名 | タイプ | 必須 | 更新可能 | 説明 | 制約 |
Enable | ブール値 | はい | いいえ | オートスケーリングを有効にするかどうかを指定します。 | 有効な値:
|
EipBandwidth | Integer | いいえ | いいえ | EIP のピーク帯域幅。 | なし |
EipInternetChargeType | String | いいえ | いいえ | EIP の課金方法。 | 有効な値:
|
IsBondEip | ブール値 | いいえ | いいえ | EIP をバインドするかどうかを指定します。 | 有効な値:
|
MinInstances | Integer | いいえ | いいえ | スケーリンググループ内のインスタンスの最小数。 | なし |
MaxInstances | Integer | いいえ | いいえ | スケーリンググループ内のインスタンスの最大数。 | なし |
Type | String | いいえ | いいえ | オートスケーリングのタイプ。 | 有効な値 (インスタンスタイプ別):
|
ScalingGroup の構文
"ScalingGroup": {
"SpotInstanceRemedy": Boolean,
"Platform": String,
"DataDisks": List,
"SystemDiskSize": Integer,
"CompensateWithOnDemand": Boolean,
"InstanceChargeType": String,
"OnDemandPercentageAboveBaseCapacity": Integer,
"AutoRenew": Boolean,
"OnDemandBaseCapacity": Integer,
"SystemDiskPerformanceLevel": String,
"ImageId": String,
"SpotPriceLimit": List,
"InstanceTypes": List,
"Tags": List,
"SpotStrategy": String,
"LoginPassword": String,
"MultiAzPolicy": String,
"AutoRenewPeriod": Integer,
"ScalingPolicy": String,
"KeyPair": String,
"VSwitchIds": List,
"SecurityGroupId": String,
"SpotInstancePools": Integer,
"Period": Integer,
"InternetChargeType": String,
"SystemDiskCategory": String,
"InternetMaxBandwidthOut": Integer,
"RdsInstances": List,
"PeriodUnit": String,
"ZoneIds": List,
"SocEnabled": Boolean,
"ImageType": String,
"InstancePatterns": List,
"SecurityHardeningOs": Boolean
}ScalingGroup のプロパティ
プロパティ名 | タイプ | 必須 | 更新許可 | 説明 | 制約 |
InstanceTypes | List | いいえ | はい | スポットインスタンスのインスタンスタイプ。 | なし |
SystemDiskSize | Integer | はい | はい | ノードのシステムディスクのサイズ。 | 単位:GiB。有効な値:40〜500。 |
VSwitchIds | List | はい | はい | vSwitch の ID。 | なし |
AutoRenew | ブール値 | いいえ | はい | ノードプール内のノードの自動更新を有効にするかどうかを指定します。 | このパラメーターは、InstanceChargeType が PrePaid に設定されている場合にのみ有効です。 有効な値:
|
AutoRenewPeriod | Integer | いいえ | はい | ノードプール内のノードの自動更新期間。 | このパラメーターは、InstanceChargeType が PrePaid に設定され、AutoRenew が true に設定されている場合にのみ有効です。この場合、AutoRenewPeriod は必須です。 PeriodUnit が Month に設定されている場合、有効な値は次のとおりです:
|
CompensateWithOnDemand | ブール値 | いいえ | はい | MultiAzPolicy が COST_OPTIMIZED に設定されている場合、価格または在庫の制約により十分なスポットインスタンスを作成できない場合に、オンデマンドインスタンスを自動的に作成するかどうかを指定します。 | 有効な値:
|
DataDisks | List | いいえ | はい | ノードプール内のノードのデータディスク構成。 | 詳細については、「DataDisks の構文」および「DataDisks のプロパティ」をご参照ください。 |
InstanceChargeType | String | いいえ | はい | ノードプール内のノードの課金方法。 | 有効な値:
|
ImageId | String | いいえ | はい | カスタムイメージの ID。 | デフォルトでは、システム提供のイメージが使用されます。 |
OnDemandPercentageAboveBaseCapacity | Integer | いいえ | はい | OnDemandBaseCapacity を超えるインスタンスのうち、オンデマンドインスタンスの割合。 | 有効な値:0〜100。 |
OnDemandBaseCapacity | Integer | いいえ | はい | スケーリンググループで必要なオンデマンドインスタンスの最小数。 | 有効な値:0〜1000。オンデマンドインスタンスの数がこの値より少ない場合、オンデマンドインスタンスが優先的に作成されます。 |
Platform | String | いいえ | はい | オペレーティングシステム。 | 有効な値:
|
Period | Integer | いいえ | はい | ノードプール内のノードの自動更新期間。このパラメーターは、サブスクリプションと自動更新を選択した場合にのみ有効です。 | PeriodUnit が Month に設定されている場合、有効な値は次のとおりです:
|
PeriodUnit | String | いいえ | はい | ノードプール内のノードの課金サイクル。 | InstanceChargeType が PrePaid に設定されている場合は、このパラメーターを指定する必要があります。 有効な値:
|
LoginPassword | String | いいえ | はい | SSH ログインパスワード。 | KeyPair または LoginPassword のいずれかを指定できますが、両方は指定できません。 パスワード要件:8〜30 文字で、次の文字タイプのうち少なくとも 3 種類を含める必要があります:英字、数字、特殊文字 |
MultiAzPolicy | String | いいえ | はい | マルチゾーンのスケーリンググループのスケーリングポリシー。 | 有効な値:
|
KeyPair | String | いいえ | はい | パスワードなしのログイン用のキーペアの名前。 | KeyPair または LoginPassword のいずれかを指定できますが、両方は指定できません。 説明 マネージドノードプールを作成する場合、KeyPair のみがサポートされます。 |
SecurityGroupId | String | いいえ | はい | セキュリティグループの ID。 | なし |
SpotInstanceRemedy | ブール値 | いいえ | はい | スポットインスタンスを使用するかどうかを指定します。 | 有効な値:
詳細については、「スポットインスタンスの作成」をご参照ください。 |
SystemDiskPerformanceLevel | String | いいえ | はい | クラウドディスクのパフォーマンスレベルを設定します。 | 有効な値:
詳細については、「ESSD (エンタープライズ SSD)」をご参照ください。 |
SpotStrategy | String | いいえ | はい | スポットインスタンスのタイプ。 | 有効な値:
詳細については、「スポットインスタンスの使用」をご参照ください。 |
SpotPriceLimit | List | いいえ | はい | インスタンスの 1 時間あたりの最大価格。 | 小数点以下の最大桁数は 3 です。このパラメーターは、SpotStrategy が SpotWithPriceLimit に設定されている場合にのみ有効です。 詳細については、「SpotPriceLimit の構文」および「SpotPriceLimit のプロパティ」をご参照ください。 |
SpotInstancePools | Integer | いいえ | はい | 利用可能なインスタンスタイプの数。スケーリンググループは、これらのインスタンスタイプにわたってコスト最適化された方法でスポットインスタンスを作成します。 | 有効な値:1〜10。 |
ScalingPolicy | String | いいえ | はい | スケーリンググループのスケーリングモード。 | 有効な値:
|
SystemDiskCategory | String | いいえ | はい | ノードのシステムディスクのタイプ。 | 有効な値:
|
InternetChargeType | String | いいえ | はい | パブリックネットワークアクセスの課金方法。 | 有効な値:
|
InternetMaxBandwidthOut | Integer | いいえ | はい | 最大パブリックアウトバウンド帯域幅。 | 単位:Mbit/s。 有効な値:1〜100 Mbit/s。 |
RdsInstances | List | いいえ | はい | RDS インスタンスの ID。 | なし |
Tags | List | いいえ | はい | ECS インスタンスにのみタグを追加できます。 | タグキーは重複できません。タグキーの最大長は 128 文字です。タグキーと値は 詳細については、「Tags の構文」および「Tags のプロパティ」をご参照ください。 |
ZoneIds | List | いいえ | はい | ゾーンの ID。 | なし |
SocEnabled | ブール値 | いいえ | いいえ | MLPS セキュリティ強化を有効にするかどうかを指定します。 | なし |
ImageType | String | いいえ | いいえ | オペレーティングシステムイメージのタイプ。 | このパラメーターまたは Platform パラメーターのいずれかを指定する必要があります。 |
InstancePatterns | List | いいえ | はい | インスタンス属性の構成。 | 詳細については、「InstancePatterns のプロパティ」をご参照ください。 |
SecurityHardeningOs | ブール値 | いいえ | いいえ | Alibaba Cloud OS セキュリティ強化。 | 有効な値:
デフォルト値: |
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 アーキテクチャ。 | 有効な値:
|
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。 |
DataDisks の構文
"DataDisks": [
{
"Category": String,
"Encrypted": Boolean,
"PerformanceLevel": String,
"Size": Integer,
"AutoSnapshotPolicyId": String,
"Categories": List
}
]DataDisks のプロパティ
プロパティ名 | タイプ | 必須 | 更新が許可されているか | 説明 | 制約 |
AutoSnapshotPolicyId | String | いいえ | はい | 自動スナップショットポリシーの ID。ポリシーに従ってディスクが自動的にバックアップされます。 | デフォルト値:空。自動バックアップは実行されません。 |
Category | String | いいえ | はい | データディスクのタイプ。 | 有効な値:
|
Encrypted | ブール値 | いいえ | はい | データディスクを暗号化するかどうかを指定します。 | 有効な値:
|
PerformanceLevel | String | いいえ | はい | ディスクのパフォーマンスレベル。 | 有効な値:
詳細については、「ESSD (エンタープライズ SSD)」をご参照ください。 |
Size | Integer | いいえ | はい | データディスクのサイズ。 | 有効な値:40〜32768。 デフォルト値:120。 単位:GiB。 |
Categories | List | いいえ | いいえ | データディスクタイプのリスト。 | なし |
SpotPriceLimit の構文
"SpotPriceLimit": [
{
"PriceLimit": Number,
"InstanceType": String
}
]SpotPriceLimit のプロパティ
プロパティ名 | タイプ | 必須 | 更新可能 | 説明 | 制約 |
PriceLimit | Number | はい | はい | プリエンプティブルインスタンスの価格上限。 | なし |
InstanceType | String | はい | はい | プリエンプティブルインスタンスのタイプ。 | なし |
Tags の構文
"Tags": [
{
"Value": String,
"Key": String
}
]Tags のプロパティ
プロパティ名 | タイプ | 必須 | 更新が許可されているか | 説明 | 制約 |
Value | String | はい | はい | タグの値。 | なし |
Key | String | はい | はい | タグのキー。 | なし |
戻り値
Fn::GetAtt
NodePoolId: クラスターノードプールの ID。
例
例 1: 固定パラメーターでノードプールを作成する
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
TeeConfig:
Type: Json
Description: 機密計算の構成。
Default: |-
{
"TeeEnable": true
}
ClusterId:
Type: String
Description: クラスター ID。
AssociationProperty: ALIYUN::CS::Cluster::ClusterId
NodePoolInfo:
Type: Json
Description: ノードプールの構成。
Default: |-
{
"Name": "test"
}
KubernetesConfig:
Type: Json
Description: ACK クラスターの構成。
Default: |-
{
"CpuPolicy": "static",
"Runtime": "containerd",
"CmsEnabled": true,
"UserData": "echo 'hello'",
"NodeNameMode": "customized,aliyun.com,5,test",
"RuntimeVersion": "1.4.8",
"Unschedulable": false
}
Count:
Type: Number
Description: ノードプール内のノード数。
Default: 1
Management:
Type: Json
Description: マネージドノードプールの構成。
Default: |-
{
"UpgradeConfig": {
"AutoUpgrade": true,
"Surge": 1,
"MaxUnavailable": 1
},
"AutoRepair": true,
"Enable": true
}
ScalingGroup:
Type: Json
Description: ノードプールで使用されるスケーリンググループの構成。
Default: |-
{
"SpotInstanceRemedy": true,
"Platform": "AliyunLinux",
"SystemDiskSize": 120,
"InstanceChargeType": "PostPaid",
"SystemDiskPerformanceLevel": "PL1",
"ImageId": "aliyun_2_1903_x64_20G_alibase_20210726.vhd",
"InstanceTypes": [
"ecs.ebmhfc6.20xlarge"
],
"LoginPassword": "test****",
"MultiAzPolicy": "BALANCE",
"VSwitchIds": [
"vsw-*****"
],
"SystemDiskCategory": "cloud_essd",
"InternetMaxBandwidthOut": 0
}
Resources:
ClusterNodePool:
Type: ALIYUN::CS::ClusterNodePool
Properties:
TeeConfig:
Ref: TeeConfig
ClusterId:
Ref: ClusterId
NodePoolInfo:
Ref: NodePoolInfo
KubernetesConfig:
Ref: KubernetesConfig
Count:
Ref: Count
Management:
Ref: Management
ScalingGroup:
Ref: ScalingGroup
Outputs:
NodePoolId:
Description: クラスターノードプール ID。
Value:
Fn::GetAtt:
- ClusterNodePool
- NodePoolId
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"TeeConfig": {
"Type": "Json",
"Description": "機密計算の構成。",
"Default": "{\n \"TeeEnable\": true\n}"
},
"ClusterId": {
"Type": "String",
"Description": "クラスター ID。",
"AssociationProperty": "ALIYUN::CS::Cluster::ClusterId"
},
"NodePoolInfo": {
"Type": "Json",
"Description": "ノードプールの構成。",
"Default": "{\n \"Name\": \"test\"\n}"
},
"KubernetesConfig": {
"Type": "Json",
"Description": "ACK クラスターの構成。",
"Default": "{\n \"CpuPolicy\": \"static\",\n \"Runtime\": \"containerd\",\n \"CmsEnabled\": true,\n \"UserData\": \"echo 'hello'\",\n \"NodeNameMode\": \"customized,aliyun.com,5,test\",\n \"RuntimeVersion\": \"1.4.8\",\n \"Unschedulable\": false\n}"
},
"Count": {
"Type": "Number",
"Description": "ノードプール内のノード数。",
"Default": 1
},
"Management": {
"Type": "Json",
"Description": "マネージドノードプールの構成。",
"Default": "{\n \"UpgradeConfig\": {\n \"AutoUpgrade\": true,\n \"Surge\": 1,\n \"MaxUnavailable\": 1\n },\n \"AutoRepair\": true,\n \"Enable\": true\n}"
},
"ScalingGroup": {
"Type": "Json",
"Description": "ノードプールで使用されるスケーリンググループの構成。",
"Default": "{\n \"SpotInstanceRemedy\": true,\n \"Platform\": \"AliyunLinux\",\n \"SystemDiskSize\": 120,\n \"InstanceChargeType\": \"PostPaid\",\n \"SystemDiskPerformanceLevel\": \"PL1\",\n \"ImageId\": \"aliyun_2_1903_x64_20G_alibase_20210726.vhd\",\n \"InstanceTypes\": [\n \"ecs.ebmhfc6.20xlarge\"\n ],\n \"LoginPassword\": \"test****\",\n \"MultiAzPolicy\": \"BALANCE\",\n \"VSwitchIds\": [\n \"vsw-*****\"\n ],\n \"SystemDiskCategory\": \"cloud_essd\",\n \"InternetMaxBandwidthOut\": 0\n}"
}
},
"Resources": {
"ClusterNodePool": {
"Type": "ALIYUN::CS::ClusterNodePool",
"Properties": {
"TeeConfig": {
"Ref": "TeeConfig"
},
"ClusterId": {
"Ref": "ClusterId"
},
"NodePoolInfo": {
"Ref": "NodePoolInfo"
},
"KubernetesConfig": {
"Ref": "KubernetesConfig"
},
"Count": {
"Ref": "Count"
},
"Management": {
"Ref": "Management"
},
"ScalingGroup": {
"Ref": "ScalingGroup"
}
}
}
},
"Outputs": {
"NodePoolId": {
"Description": "クラスターノードプール ID。",
"Value": {
"Fn::GetAtt": [
"ClusterNodePool",
"NodePoolId"
]
}
}
}
}例 2: 動的パラメーターでノードプールを作成する
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
ClusterId:
AssociationProperty: ALIYUN::CS::Cluster::ClusterId
Type: String
VpcId:
Type: String
AssociationProperty: ALIYUN::ECS::VPC::VPCId
ZoneId1:
Type: String
AssociationProperty: 'ALIYUN::ECS::Instance::ZoneId'
AssociationPropertyMetadata:
ExclusiveTo:
- ZoneId2
Label:
en: アベイラビリティゾーン
zh-cn: アベイラビリティゾーン 1
VSwitchId1:
Type: String
AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
AssociationPropertyMetadata:
ZoneId: ${ZoneId1}
VpcId: ${VpcId}
ZoneId2:
Type: String
AssociationProperty: 'ALIYUN::ECS::Instance::ZoneId'
AssociationPropertyMetadata:
ExclusiveTo:
- ZoneId1
Label:
en: アベイラビリティゾーン
zh-cn: アベイラビリティゾーン 2
InstanceType:
Type: CommaDelimitedList
AssociationProperty: 'ALIYUN::ECS::Instance::InstanceType'
AssociationPropertyMetadata:
InstanceChargeType: PostPaid
SystemDiskCategory: cloud_essd
CreateACKClusterParams:
NetworkPlugin: terway-eniip
Label:
en: インスタンスタイプ
zh-cn: インスタンスタイプ
InstancePassword:
NoEcho: true
Type: String
Description:
en: >-
サーバーのログインパスワード。長さは 8〜30 文字で、大文字、小文字、数字、および特殊文字 (()\`~!@#$%^&*_-+=|{}[]:;'<>,.?/) のうち 3 種類以上を含む必要があります。
zh-cn: >-
サーバーのログインパスワード。パスワードは 8〜30 文字の長さで、次のカテゴリのうち少なくとも 3 つの文字タイプを含める必要があります:大文字、小文字、数字、および次のセットからの特殊文字:()`~!@#$%^&*_-+=|{}[]:;'<>,.?/
Label:
en: インスタンスパスワード
zh-cn: インスタンスパスワード
ConstraintDescription:
en: >-
長さは 8〜30 文字で、大文字、小文字、数字、および特殊文字 (()\`~!@#$%^&*_-+=|{}[]:;'<>,.?/) のうち 3 種類以上を含む必要があります。
zh-cn: 'パスワードは 8〜30 文字の長さで、次のカテゴリのうち少なくとも 3 つの文字タイプを含める必要があります:大文字、小文字、数字、および次のセットからの特殊文字:()`~!@#$%^&*_-+=|{}[]:;''<>,.?/'
AssociationProperty: 'ALIYUN::ECS::Instance::Password'
Default: null
Resources:
NodePools:
Type: 'ALIYUN::CS::ClusterNodePool'
Properties:
ClusterId:
Ref: ClusterId
NodePoolInfo:
Name: k8s-hpa-cluster-nodepool
ScalingGroup:
VSwitchIds:
- Ref: VSwitchId1
- Ref: VSwitchId2
ZoneIds:
- Ref: ZoneId1
- Ref: ZoneId2
SystemDiskCategory: cloud_essd
SystemDiskPerformanceLevel: PL0
SystemDiskSize: 40
InstanceTypes:
Ref: InstanceType
LoginPassword:
Ref: InstancePassword
Platform: AliyunLinux
ImageId: aliyun_3_9_x64_20G_alibase_20231219.vhd
KubernetesConfig:
Runtime: containerd
RuntimeVersion: 1.6.28
AutoScaling:
Enable: true
MinInstances: 2
MaxInstances: 10
Outputs:
NodePoolId:
Description:
zh-cn: コーヒーサービスのエンドポイント。
en: コーヒーサービスのアドレス。
Value:
Ref: NodePools
Metadata:
'ALIYUN::ROS::Interface':
ParameterGroups:
- Parameters:
- ClusterId
- VpcId
- ZoneId1
- VSwitchId1
- ZoneId2
- VSwitchId2
- InstanceType
- InstancePassword
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"ClusterId": {
"AssociationProperty": "ALIYUN::CS::Cluster::ClusterId",
"Type": "String"
},
"VpcId": {
"Type": "String",
"AssociationProperty": "ALIYUN::ECS::VPC::VPCId"
},
"ZoneId1": {
"Type": "String",
"AssociationProperty": "ALIYUN::ECS::Instance::ZoneId",
"AssociationPropertyMetadata": {
"ExclusiveTo": [
"ZoneId2"
]
},
"Label": {
"en": "アベイラビリティゾーン",
"zh-cn": "ゾーン 1"
}
},
"VSwitchId1": {
"Type": "String",
"AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
"AssociationPropertyMetadata": {
"ZoneId": "${ZoneId1}",
"VpcId": "${VpcId}"
}
},
"ZoneId2": {
"Type": "String",
"AssociationProperty": "ALIYUN::ECS::Instance::ZoneId",
"AssociationPropertyMetadata": {
"ExclusiveTo": [
"ZoneId1"
]
},
"Label": {
"en": "アベイラビリティゾーン",
"zh-cn": "ゾーン 2"
}
},
"VSwitchId2": {
"Type": "String",
"AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
"AssociationPropertyMetadata": {
"ZoneId": "${ZoneId2}",
"VpcId": "${VpcId}"
}
},
"InstanceType": {
"Type": "CommaDelimitedList",
"AssociationProperty": "ALIYUN::ECS::Instance::InstanceType",
"AssociationPropertyMetadata": {
"InstanceChargeType": "PostPaid",
"SystemDiskCategory": "cloud_essd",
"CreateACKClusterParams": {
"NetworkPlugin": "terway-eniip"
}
},
"Label": {
"en": "インスタンスタイプ",
"zh-cn": "インスタンスタイプ"
}
},
"InstancePassword": {
"NoEcho": true,
"Type": "String",
"Description": {
"en": "サーバーのログインパスワード。長さは 8〜30 文字で、大文字、小文字、数字、および特殊文字 (()\`~!@#$%^&*_-+=|{}[]:;'<>,.?/) のうち 3 種類以上を含む必要があります。",
"zh-cn": "サーバーのログインパスワード。パスワードは 8〜30 文字の長さで、次のカテゴリのうち少なくとも 3 つの文字タイプを含める必要があります:大文字、小文字、数字、および特殊文字:()`~!@#$%^&*_-+=|{}[]:;'<>,.?/"
},
"Label": {
"en": "インスタンスパスワード",
"zh-cn": "インスタンスパスワード"
},
"ConstraintDescription": {
"en": "長さは 8〜30 文字で、大文字、小文字、数字、および特殊文字 (()\`~!@#$%^&*_-+=|{}[]:;'<>,.?/) のうち 3 種類以上を含む必要があります。",
"zh-cn": "パスワードは 8〜30 文字の長さで、次のカテゴリのうち少なくとも 3 つの文字タイプを含める必要があります:大文字、小文字、数字、および特殊文字:()`~!@#$%^&*_-+=|{}[]:;''<>,.?/"
},
"AssociationProperty": "ALIYUN::ECS::Instance::Password",
"Default": null
}
},
"Resources": {
"NodePools": {
"Type": "ALIYUN::CS::ClusterNodePool",
"Properties": {
"ClusterId": {
"Ref": "ClusterId"
},
"NodePoolInfo": {
"Name": "k8s-hpa-cluster-nodepool"
},
"ScalingGroup": {
"VSwitchIds": [
{
"Ref": "VSwitchId1"
},
{
"Ref": "VSwitchId2"
}
],
"ZoneIds": [
{
"Ref": "ZoneId1"
},
{
"Ref": "ZoneId2"
}
],
"SystemDiskCategory": "cloud_essd",
"SystemDiskPerformanceLevel": "PL0",
"SystemDiskSize": 40,
"InstanceTypes": {
"Ref": "InstanceType"
},
"LoginPassword": {
"Ref": "InstancePassword"
},
"Platform": "AliyunLinux",
"ImageId": "aliyun_3_9_x64_20G_alibase_20231219.vhd"
},
"KubernetesConfig": {
"Runtime": "containerd",
"RuntimeVersion": "1.6.28"
},
"AutoScaling": {
"Enable": true,
"MinInstances": 2,
"MaxInstances": 10
}
}
}
},
"Outputs": {
"NodePoolId": {
"Description": {
"zh-cn": "コーヒーサービスのエンドポイント。",
"en": "コーヒーサービスのアドレス。"
},
"Value": {
"Ref": "NodePools"
}
}
},
"Metadata": {
"ALIYUN::ROS::Interface": {
"ParameterGroups": [
{
"Parameters": [
"ClusterId",
"VpcId",
"ZoneId1",
"VSwitchId1",
"ZoneId2",
"VSwitchId2",
"InstanceType",
"InstancePassword"
]
}
]
}
}
}例 3: マネージド Kubernetes クラスターを作成し、VPC とノードプールを設定する
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: マネージド Kubernetes クラスターを作成し、VPC、ノードプール、Horizontal Pod Autoscaler (HPA)、および Simple Log Service を設定して、コンテナ化されたアプリケーションの自動スケーリングとモニタリングを有効にします。
en: マネージド Kubernetes クラスターを作成し、Virtual Private Cloud (VPC)、ノードプール、Horizontal Pod Autoscaler (HPA)、およびロギングサービスを設定して、コンテナ化されたアプリケーションの自動スケーリングとモニタリングを有効にします。
Parameters:
CommonName:
Type: String
Default: k8s-hpa-cluster
SlsProjectName:
Type: String
Label:
en: SLS プロジェクトの名前
zh-cn: SLS プロジェクトの名前
Description:
en: 名前には 3〜36 文字が含まれます。小文字または数字で始まり、終わる必要があります。値には小文字、数字、ハイフン (-) を含めることができます。
zh-cn: 名前は 3〜36 文字の長さでなければなりません。小文字または数字で始まり、終わる必要があります。小文字、数字、ハイフン (-) を含めることができます。
AssociationProperty: AutoCompleteInput
AssociationPropertyMetadata:
Length: 5
Prefix: k8s-hpa-sls-project-
CharacterClasses:
- Class: lowercase
min: 1
ManagedKubernetesClusterName:
Type: String
Label:
en: マネージド Kubernetes クラスター名
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: アベイラビリティゾーン
zh-cn: ゾーン 1
ZoneId2:
Type: String
AssociationProperty: 'ALIYUN::ECS::Instance::ZoneId'
AssociationPropertyMetadata:
ExclusiveTo:
- ZoneId1
Label:
en: アベイラビリティゾーン
zh-cn: ゾーン 2
InstanceType:
Type: CommaDelimitedList
AssociationProperty: 'ALIYUN::ECS::Instance::InstanceType'
AssociationPropertyMetadata:
InstanceChargeType: PostPaid
SystemDiskCategory: cloud_essd
CreateACKClusterParams:
NetworkPlugin: terway-eniip
Label:
en: インスタンスタイプ
zh-cn: インスタンスタイプ
InstancePassword:
NoEcho: true
Type: String
Description:
en: >-
サーバーのログインパスワード。長さは 8〜30 文字で、大文字、小文字、数字、および特殊文字 (()\`~!@#$%^&*_-+=|{}[]:;'<>,.?/) のうち 3 種類以上を含む必要があります。
zh-cn: >-
サーバーのログインパスワード。パスワードは 8〜30 文字の長さで、次のカテゴリのうち少なくとも 3 つの文字タイプを含める必要があります:大文字、小文字、数字、および特殊文字:()`~!@#$%^&*_-+=|{}[]:;'<>,.?/
Label:
en: インスタンスパスワード
zh-cn: インスタンスパスワード
ConstraintDescription:
en: >-
長さは 8〜30 文字で、大文字、小文字、数字、および特殊文字 (()\`~!@#$%^&*_-+=|{}[]:;'<>,.?/) のうち 3 種類以上を含む必要があります。
zh-cn: 'パスワードは 8〜30 文字の長さで、次のカテゴリのうち少なくとも 3 つの文字タイプを含める必要があります:大文字、小文字、数字、および特殊文字:()`~!@#$%^&*_-+=|{}[]:;''<>,.?/'
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: 443/443
SourceCidrIp: 0.0.0.0/0
IpProtocol: tcp
- PortRange: 80/80
SourceCidrIp: 0.0.0.0/0
IpProtocol: tcp
SlsProject:
Type: 'ALIYUN::SLS::Project'
Properties:
Name:
Ref: SlsProjectName
AliyunCSManagedAutoScalerRole:
Type: 'ALIYUN::RAM::Role'
Properties:
RoleName: AliyunCSManagedAutoScalerRole
Description: ACK はこのロールを使用して、他の Alibaba Cloud サービスのリソースにアクセスします。
AssumeRolePolicyDocument:
Version: '1'
Statement:
- Action: sts:AssumeRole
Effect: Allow
Principal:
Service:
- cs.aliyuncs.com
MaxSessionDuration: 3600
IgnoreExisting: true
DeletionForce: true
PolicyAttachments:
System:
- AliyunCSManagedAutoScalerRolePolicy
AckCluster:
Type: 'ALIYUN::CS::ManagedKubernetesCluster'
DependsOn: AliyunCSManagedAutoScalerRole
Properties:
VpcId:
Ref: Vpc
VSwitchIds:
- Ref: VSwitch1
- Ref: VSwitch2
PodVswitchIds:
- Ref: VSwitch1
- Ref: VSwitch1
Name:
Ref: ManagedKubernetesClusterName
KubernetesVersion: 1.31.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: ack-node-local-dns
- 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: nginx-ingress-controller
Disabled: true
- Name: logtail-ds
Config: '{"IngressDashboardEnabled":"true"}'
- Name: alb-ingress-controller
Version: ""
Config:
Fn::Sub: >-
{"albIngress":{"AddressType":"Internet","ZoneMappings":{"${ZoneId1}":["${VSwitch1}"],
"${ZoneId2}":["${VSwitch2}"]},"CreateDefaultALBConfig":true}}
- Name: ack-helm-manager
- Name: arms-prometheus
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: k8s-hpa-cluster-nodepool
ScalingGroup:
VSwitchIds:
- Ref: VSwitch1
- Ref: VSwitch2
ZoneIds:
- Ref: ZoneId1
- Ref: ZoneId2
SystemDiskCategory: cloud_essd
SystemDiskPerformanceLevel: PL0
SystemDiskSize: 40
InstanceTypes:
Ref: InstanceType
LoginPassword:
Ref: InstancePassword
Platform: AliyunLinux
ImageId: aliyun_3_9_x64_20G_alibase_20231219.vhd
KubernetesConfig:
Runtime: containerd
RuntimeVersion: 1.6.28
AutoScaling:
Enable: true
MinInstances: 2
MaxInstances: 10
Sleep:
Type: 'ALIYUN::ROS::Sleep'
DependsOn: NodePools
Properties:
CreateDuration: 300
AckMetricsAdapter:
Type: 'ALIYUN::CS::ClusterHelmApplication'
DependsOn: Sleep
Properties:
Namespace: kube-system
ChartUrl: 'https://aliacs-app-catalog.oss-cn-hangzhou.aliyuncs.com/charts-incubator/ack-alibaba-cloud-metrics-adapter-1.3.3.tgz'
ClusterId:
Ref: AckCluster
Name: ack-alibaba-cloud-metrics-adapter
ChartValues:
AlibabaCloudMetricsAdapter:
commonLabels: ''
replicas: 1
resources:
metricsAdapterDeployment:
resources:
limits:
cpu: 0.5
memory: 1Gi
requests:
cpu: 100m
memory: 200Mi
configReloader:
resources:
limits:
cpu: 20m
memory: 30Mi
requests:
cpu: 20m
memory: 30Mi
listenPort: 443
costWeights:
cpu: '1.0'
memory: '0.0'
image:
repository: registry-cn-hangzhou-vpc.ack.aliyuncs.com/acs/alibaba-cloud-metrics-adapter-amd64
tag: v0.2.7-f1ee5c3-aliyun
pullPolicy: Always
nameOverride: ''
fullnameOverride: ''
service:
type: ClusterIP
serviceAccountName: ack-alibaba-cloud-metrics-adapter
annotations: { }
nodeSelector: { }
tolerations: [ ]
env:
- AccessKeyId: ''
- AccessKeySecret: ''
- Region: ''
affinity: { }
prometheus:
enabled: true
url: { }
metricsRelistInterval: 1m
logLevel: 5
adapter:
rules:
default: false
custom:
- seriesQuery: container_memory_working_set_bytes{namespace!="",pod!=""}
resources:
overrides:
namespace:
resource: namespace
pod:
resource: pod
name:
matches: ^(.*)_bytes
as: ${1}_bytes_per_second
metricsQuery: sum(<<.Series>>{<<.LabelMatchers>>}) by (<<.GroupBy>>)
- seriesQuery: container_cpu_usage_seconds_total{namespace!="",pod!=""}
resources:
overrides:
namespace:
resource: namespace
pod:
resource: pod
name:
matches: ^(.*)_seconds_total
as: ${1}_core_per_second
metricsQuery: sum(rate(<<.Series>>{<<.LabelMatchers>>}[1m])) by (<<.GroupBy>>)
ConfigReloader:
image:
repository: registry-vpc.cn-hangzhou.aliyuncs.com/acs/configmap-reload
tag: v0.0.1
InstallBackendApp:
Type: 'ALIYUN::CS::ClusterApplication'
DependsOn: AckMetricsAdapter
Properties:
ClusterId:
Ref: AckCluster
YamlContent:
Fn::Sub: |-
apiVersion: apps/v1
kind: Deployment
metadata:
name: coffee
spec:
replicas: 2
selector:
matchLabels:
app: coffee
template:
metadata:
labels:
app: coffee
spec:
containers:
- name: coffee
image: registry.${ALIYUN::Region}.aliyuncs.com/acs-sample/nginxdemos:latest
ports:
- containerPort: 80
resources:
limits:
cpu: 500m
memory: 1Gi
requests:
cpu: 500m
memory: 512Mi
---
apiVersion: v1
kind: Service
metadata:
name: coffee-svc
spec:
ports:
- port: 80
targetPort: 80
protocol: TCP
selector:
app: coffee
type: NodePort
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: tea
spec:
replicas: 2
selector:
matchLabels:
app: tea
template:
metadata:
labels:
app: tea
spec:
containers:
- name: tea
image: registry.${ALIYUN::Region}.aliyuncs.com/acs-sample/nginxdemos:latest
ports:
- containerPort: 80
resources:
limits:
cpu: 500m
memory: 1Gi
requests:
cpu: 500m
memory: 512Mi
---
apiVersion: v1
kind: Service
metadata:
name: tea-svc
spec:
ports:
- port: 80
targetPort: 80
protocol: TCP
selector:
app: tea
type: NodePort
AlbConfig:
Type: 'ALIYUN::CS::ClusterApplication'
DependsOn: InstallBackendApp
Properties:
ClusterId:
Ref: AckCluster
YamlContent:
Fn::Sub: |-
apiVersion: alibabacloud.com/v1
kind: AlbConfig
metadata:
name: k8s-hpa-alb-config
spec:
config:
name: k8s-hpa-alb
addressType: Internet
zoneMappings:
- vSwitchId: ${VSwitch1}
- vSwitchId: ${VSwitch2}
accessLogConfig:
logProject: ${SlsProject}
logStore: "alb_k8s_hpa_sls_logstore"
listeners:
- port: 80
protocol: HTTP
IngressClass:
Type: 'ALIYUN::CS::ClusterApplication'
DependsOn: AlbConfig
Properties:
ClusterId:
Ref: AckCluster
YamlContent:
Fn::Sub: |-
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
name: k8s-hpa-alb-ingress-class
spec:
controller: ingress.k8s.alibabacloud/alb
parameters:
apiGroup: alibabacloud.com
kind: AlbConfig
name: k8s-hpa-alb-config
Ingress:
Type: 'ALIYUN::CS::ClusterApplication'
DependsOn: IngressClass
Properties:
ClusterId:
Ref: AckCluster
YamlContent:
Fn::Sub: |-
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: k8s-hpa-alb-ingress
spec:
ingressClassName: k8s-hpa-alb-ingress-class
rules:
- http:
paths:
- path: /tea
pathType: ImplementationSpecific
backend:
service:
name: tea-svc
port:
number: 80
- path: /coffee
pathType: ImplementationSpecific
backend:
service:
name: coffee-svc
port:
number: 80
Hpa:
Type: 'ALIYUN::CS::ClusterApplication'
DependsOn: WaitAlbIngress
Properties:
ClusterId:
Ref: AckCluster
YamlContent:
Fn::Sub: |-
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: k8s-alb-tea-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: tea
minReplicas: 2
maxReplicas: 10
metrics:
- type: External
external:
metric:
name: sls_alb_ingress_qps
selector:
matchLabels:
sls.project: ${SlsProject}
sls.logstore: "alb_k8s_hpa_sls_logstore"
sls.ingress.route: "default-tea-svc-80"
target:
type: AverageValue
averageValue: 2
- resource:
name: cpu
target:
averageUtilization: 80
type: Utilization
type: Resource
- resource:
name: memory
target:
averageUtilization: 80
type: Utilization
type: Resource
WaitAlbIngress:
Type: 'ALIYUN::ROS::Sleep'
DependsOn: Ingress
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:
TeaUrl:
Description:
zh-cn: ティーサービスのエンドポイント。
en: ティーサービスのアドレス。
Value:
'Fn::Sub': http://${IngressInfo}/tea
CoffeeUrl:
Description:
zh-cn: コーヒーサービスのエンドポイント。
en: コーヒーサービスのアドレス。
Value:
'Fn::Sub': http://${IngressInfo}/coffee
Metadata:
'ALIYUN::ROS::Interface':
ParameterGroups:
- Parameters:
- SlsProjectName
- ManagedKubernetesClusterName
- ZoneId1
- ZoneId2
- InstanceType
- InstancePassword
TemplateTags:
- acs:technical-solution:micro:Implement horizontal scaling for containerized applications using HPA-tech_solu_125
Hidden:
- CommonName{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
"zh-cn": "マネージド Kubernetes クラスターを作成し、VPC、ノードプール、Horizontal Pod Autoscaler (HPA)、および Simple Log Service を設定して、コンテナ化されたアプリケーションの自動スケーリングとモニタリングを有効にします。",
"en": "マネージド Kubernetes クラスターを作成し、Virtual Private Cloud (VPC)、ノードプール、Horizontal Pod Autoscaler (HPA)、およびロギングサービスを設定して、コンテナ化されたアプリケーションの自動スケーリングとモニタリングを有効にします。"
},
"Parameters": {
"CommonName": {
"Type": "String",
"Default": "k8s-hpa-cluster"
},
"SlsProjectName": {
"Type": "String",
"Label": {
"en": "SLS プロジェクトの名前",
"zh-cn": "SLS プロジェクトの名前"
},
"Description": {
"en": "名前には 3〜36 文字が含まれます。小文字または数字で始まり、終わる必要があります。値には小文字、数字、ハイフン (-) を含めることができます。",
"zh-cn": "名前は 3〜36 文字の長さでなければなりません。小文字または数字で始まり、終わる必要があります。小文字、数字、ハイフン (-) を含めることができます。"
},
"AssociationProperty": "AutoCompleteInput",
"AssociationPropertyMetadata": {
"Length": 5,
"Prefix": "k8s-hpa-sls-project-",
"CharacterClasses": [
{
"Class": "lowercase",
"min": 1
}
]
}
},
"ManagedKubernetesClusterName": {
"Type": "String",
"Label": {
"en": "マネージド Kubernetes クラスター名",
"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": "アベイラビリティゾーン",
"zh-cn": "ゾーン 1"
}
},
"ZoneId2": {
"Type": "String",
"AssociationProperty": "ALIYUN::ECS::Instance::ZoneId",
"AssociationPropertyMetadata": {
"ExclusiveTo": [
"ZoneId1"
]
},
"Label": {
"en": "アベイラビリティゾーン",
"zh-cn": "ゾーン 2"
}
},
"InstanceType": {
"Type": "CommaDelimitedList",
"AssociationProperty": "ALIYUN::ECS::Instance::InstanceType",
"AssociationPropertyMetadata": {
"InstanceChargeType": "PostPaid",
"SystemDiskCategory": "cloud_essd",
"CreateACKClusterParams": {
"NetworkPlugin": "terway-eniip"
}
},
"Label": {
"en": "インスタンスタイプ",
"zh-cn": "インスタンスタイプ"
}
},
"InstancePassword": {
"NoEcho": true,
"Type": "String",
"Description": {
"en": "サーバーのログインパスワード。長さは 8〜30 文字で、大文字、小文字、数字、および特殊文字 (()\`~!@#$%^&*_-+=|{}[]:;'<>,.?/) のうち 3 種類以上を含む必要があります。",
"zh-cn": "サーバーのログインパスワード。パスワードは 8〜30 文字の長さで、次のカテゴリのうち少なくとも 3 つの文字タイプを含める必要があります:大文字、小文字、数字、および特殊文字:()`~!@#$%^&*_-+=|{}[]:;'<>,.?/"
},
"Label": {
"en": "インスタンスパスワード",
"zh-cn": "インスタンスパスワード"
},
"ConstraintDescription": {
"en": "長さは 8〜30 文字で、大文字、小文字、数字、および特殊文字 (()\`~!@#$%^&*_-+=|{}[]:;'<>,.?/) のうち 3 種類以上を含む必要があります。",
"zh-cn": "パスワードは 8〜30 文字の長さで、次のカテゴリのうち少なくとも 3 つの文字タイプを含める必要があります:大文字、小文字、数字、および特殊文字:()`~!@#$%^&*_-+=|{}[]:;'<>,.?/"
},
"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": "443/443",
"SourceCidrIp": "0.0.0.0/0",
"IpProtocol": "tcp"
},
{
"PortRange": "80/80",
"SourceCidrIp": "0.0.0.0/0",
"IpProtocol": "tcp"
}
]
}
},
"SlsProject": {
"Type": "ALIYUN::SLS::Project",
"Properties": {
"Name": {
"Ref": "SlsProjectName"
}
}
},
"AliyunCSManagedAutoScalerRole": {
"Type": "ALIYUN::RAM::Role",
"Properties": {
"RoleName": "AliyunCSManagedAutoScalerRole",
"Description": "ACK はこのロールを使用して、他の Alibaba Cloud サービスのリソースにアクセスします。",
"AssumeRolePolicyDocument": {
"Version": "1",
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": [
"cs.aliyuncs.com"
]
}
}
]
},
"MaxSessionDuration": 3600,
"IgnoreExisting": true,
"DeletionForce": true,
"PolicyAttachments": {
"System": [
"AliyunCSManagedAutoScalerRolePolicy"
]
}
}
},
"AckCluster": {
"Type": "ALIYUN::CS::ManagedKubernetesCluster",
"DependsOn": "AliyunCSManagedAutoScalerRole",
"Properties": {
"VpcId": {
"Ref": "Vpc"
},
"VSwitchIds": [
{
"Ref": "VSwitch1"
},
{
"Ref": "VSwitch2"
}
],
"PodVswitchIds": [
{
"Ref": "VSwitch1"
},
{
"Ref": "VSwitch1"
}
],
"Name": {
"Ref": "ManagedKubernetesClusterName"
},
"KubernetesVersion": "1.31.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": "ack-node-local-dns"
},
{
"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": "nginx-ingress-controller",
"Disabled": true
},
{
"Name": "logtail-ds",
"Config": "{\"IngressDashboardEnabled\":\"true\"}"
},
{
"Name": "alb-ingress-controller",
"Version": "",
"Config": {
"Fn::Sub": "{\"albIngress\":{\"AddressType\":\"Internet\",\"ZoneMappings\":{\"${ZoneId1}\":[\"${VSwitch1}\"], \"${ZoneId2}\":[\"${VSwitch2}\"]},\"CreateDefaultALBConfig\":true}}"
}
},
{
"Name": "ack-helm-manager"
},
{
"Name": "arms-prometheus"
}
],
"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": "k8s-hpa-cluster-nodepool"
},
"ScalingGroup": {
"VSwitchIds": [
{
"Ref": "VSwitch1"
},
{
"Ref": "VSwitch2"
}
],
"ZoneIds": [
{
"Ref": "ZoneId1"
},
{
"Ref": "ZoneId2"
}
],
"SystemDiskCategory": "cloud_essd",
"SystemDiskPerformanceLevel": "PL0",
"SystemDiskSize": 40,
"InstanceTypes": {
"Ref": "InstanceType"
},
"LoginPassword": {
"Ref": "InstancePassword"
},
"Platform": "AliyunLinux",
"ImageId": "aliyun_3_9_x64_20G_alibase_20231219.vhd"
},
"KubernetesConfig": {
"Runtime": "containerd",
"RuntimeVersion": "1.6.28"
},
"AutoScaling": {
"Enable": true,
"MinInstances": 2,
"MaxInstances": 10
}
}
},
"Sleep": {
"Type": "ALIYUN::ROS::Sleep",
"DependsOn": "NodePools",
"Properties": {
"CreateDuration": 300
}
},
"AckMetricsAdapter": {
"Type": "ALIYUN::CS::ClusterHelmApplication",
"DependsOn": "Sleep",
"Properties": {
"Namespace": "kube-system",
"ChartUrl": "https://aliacs-app-catalog.oss-cn-hangzhou.aliyuncs.com/charts-incubator/ack-alibaba-cloud-metrics-adapter-1.3.3.tgz",
"ClusterId": {
"Ref": "AckCluster"
},
"Name": "ack-alibaba-cloud-metrics-adapter",
"ChartValues": {
"AlibabaCloudMetricsAdapter": {
"commonLabels": "",
"replicas": 1,
"resources": {
"metricsAdapterDeployment": {
"resources": {
"limits": {
"cpu": 0.5,
"memory": "1Gi"
},
"requests": {
"cpu": "100m",
"memory": "200Mi"
}
}
},
"configReloader": {
"resources": {
"limits": {
"cpu": "20m",
"memory": "30Mi"
},
"requests": {
"cpu": "20m",
"memory": "30Mi"
}
}
}
},
"listenPort": 443,
"costWeights": {
"cpu": "1.0",
"memory": "0.0"
},
"image": {
"repository": "registry-cn-hangzhou-vpc.ack.aliyuncs.com/acs/alibaba-cloud-metrics-adapter-amd64",
"tag": "v0.2.7-f1ee5c3-aliyun",
"pullPolicy": "Always"
},
"nameOverride": "",
"fullnameOverride": "",
"service": {
"type": "ClusterIP"
},
"serviceAccountName": "ack-alibaba-cloud-metrics-adapter",
"annotations": {},
"nodeSelector": {},
"tolerations": [],
"env": [
{
"AccessKeyId": ""
},
{
"AccessKeySecret": ""
},
{
"Region": ""
}
],
"affinity": {},
"prometheus": {
"enabled": true,
"url": {},
"metricsRelistInterval": "1m",
"logLevel": 5,
"adapter": {
"rules": {
"default": false,
"custom": [
{
"seriesQuery": "container_memory_working_set_bytes{namespace!=\"\",pod!=\"\"}",
"resources": {
"overrides": {
"namespace": {
"resource": "namespace"
},
"pod": {
"resource": "pod"
}
}
},
"name": {
"matches": "^(.*)_bytes",
"as": "${1}_bytes_per_second"
},
"metricsQuery": "sum(<<.Series>>{<<.LabelMatchers>>}) by (<<.GroupBy>>)"
},
{
"seriesQuery": "container_cpu_usage_seconds_total{namespace!=\"\",pod!=\"\"}",
"resources": {
"overrides": {
"namespace": {
"resource": "namespace"
},
"pod": {
"resource": "pod"
}
}
},
"name": {
"matches": "^(.*)_seconds_total",
"as": "${1}_core_per_second"
},
"metricsQuery": "sum(rate(<<.Series>>{<<.LabelMatchers>>}[1m])) by (<<.GroupBy>>)"
}
]
}
}
}
},
"ConfigReloader": {
"image": {
"repository": "registry-vpc.cn-hangzhou.aliyuncs.com/acs/configmap-reload",
"tag": "v0.0.1"
}
}
}
}
},
"InstallBackendApp": {
"Type": "ALIYUN::CS::ClusterApplication",
"DependsOn": "AckMetricsAdapter",
"Properties": {
"ClusterId": {
"Ref": "AckCluster"
},
"YamlContent": {
"Fn::Sub": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: coffee\nspec:\n replicas: 2\n selector:\n matchLabels:\n app: coffee\n template:\n metadata:\n labels:\n app: coffee\n spec:\n containers:\n - name: coffee\n image: registry.${ALIYUN::Region}.aliyuncs.com/acs-sample/nginxdemos:latest\n ports:\n - containerPort: 80\n resources:\n limits:\n cpu: 500m\n memory: 1Gi\n requests:\n cpu: 500m\n memory: 512Mi\n---\napiVersion: v1\nkind: Service\nmetadata:\n name: coffee-svc\nspec:\n ports:\n - port: 80\n targetPort: 80\n protocol: TCP\n selector:\n app: coffee\n type: NodePort\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: tea\nspec:\n replicas: 2\n selector:\n matchLabels:\n app: tea\n template:\n metadata:\n labels:\n app: tea\n spec:\n containers:\n - name: tea\n image: registry.${ALIYUN::Region}.aliyuncs.com/acs-sample/nginxdemos:latest\n ports:\n - containerPort: 80\n resources:\n limits:\n cpu: 500m\n memory: 1Gi\n requests:\n cpu: 500m\n memory: 512Mi\n---\napiVersion: v1\nkind: Service\nmetadata:\n name: tea-svc\nspec:\n ports:\n - port: 80\n targetPort: 80\n protocol: TCP\n selector:\n app: tea\n type: NodePort"
}
}
},
"AlbConfig": {
"Type": "ALIYUN::CS::ClusterApplication",
"DependsOn": "InstallBackendApp",
"Properties": {
"ClusterId": {
"Ref": "AckCluster"
},
"YamlContent": {
"Fn::Sub": "apiVersion: alibabacloud.com/v1\nkind: AlbConfig\nmetadata:\n name: k8s-hpa-alb-config\nspec:\n config:\n name: k8s-hpa-alb\n addressType: Internet\n zoneMappings:\n - vSwitchId: ${VSwitch1}\n - vSwitchId: ${VSwitch2}\n accessLogConfig:\n logProject: ${SlsProject}\n logStore: \"alb_k8s_hpa_sls_logstore\"\n listeners:\n - port: 80\n protocol: HTTP"
}
}
},
"IngressClass": {
"Type": "ALIYUN::CS::ClusterApplication",
"DependsOn": "AlbConfig",
"Properties": {
"ClusterId": {
"Ref": "AckCluster"
},
"YamlContent": {
"Fn::Sub": "apiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n name: k8s-hpa-alb-ingress-class\nspec:\n controller: ingress.k8s.alibabacloud/alb\n parameters:\n apiGroup: alibabacloud.com\n kind: AlbConfig\n name: k8s-hpa-alb-config"
}
}
},
"Ingress": {
"Type": "ALIYUN::CS::ClusterApplication",
"DependsOn": "IngressClass",
"Properties": {
"ClusterId": {
"Ref": "AckCluster"
},
"YamlContent": {
"Fn::Sub": "apiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n name: k8s-hpa-alb-ingress\nspec:\n ingressClassName: k8s-hpa-alb-ingress-class\n rules:\n - http:\n paths:\n - path: /tea\n pathType: ImplementationSpecific\n backend:\n service:\n name: tea-svc\n port:\n number: 80\n - path: /coffee\n pathType: ImplementationSpecific\n backend:\n service:\n name: coffee-svc\n port: \n number: 80"
}
}
},
"Hpa": {
"Type": "ALIYUN::CS::ClusterApplication",
"DependsOn": "WaitAlbIngress",
"Properties": {
"ClusterId": {
"Ref": "AckCluster"
},
"YamlContent": {
"Fn::Sub": "apiVersion: autoscaling/v2\nkind: HorizontalPodAutoscaler\nmetadata:\n name: k8s-alb-tea-hpa\nspec:\n scaleTargetRef:\n apiVersion: apps/v1\n kind: Deployment\n name: tea\n minReplicas: 2\n maxReplicas: 10\n metrics:\n - type: External\n external:\n metric:\n name: sls_alb_ingress_qps\n selector:\n matchLabels:\n sls.project: ${SlsProject}\n sls.logstore: \"alb_k8s_hpa_sls_logstore\" \n sls.ingress.route: \"default-tea-svc-80\"\n target:\n type: AverageValue\n averageValue: 2\n - resource:\n name: cpu\n target:\n averageUtilization: 80\n type: Utilization\n type: Resource\n - resource:\n name: memory\n target:\n averageUtilization: 80\n type: Utilization\n type: Resource"
}
}
},
"WaitAlbIngress": {
"Type": "ALIYUN::ROS::Sleep",
"DependsOn": "Ingress",
"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": {
"TeaUrl": {
"Description": {
"zh-cn": "ティーサービスのエンドポイント。",
"en": "ティーサービスのアドレス。"
},
"Value": {
"Fn::Sub": "http://${IngressInfo}/tea"
}
},
"CoffeeUrl": {
"Description": {
"zh-cn": "コーヒーサービスのエンドポイント。",
"en": "コーヒーサービスのアドレス。"
},
"Value": {
"Fn::Sub": "http://${IngressInfo}/coffee"
}
}
},
"Metadata": {
"ALIYUN::ROS::Interface": {
"ParameterGroups": [
{
"Parameters": [
"SlsProjectName",
"ManagedKubernetesClusterName",
"ZoneId1",
"ZoneId2",
"InstanceType",
"InstancePassword"
]
}
],
"TemplateTags": [
"acs:technical-solution:micro:Implement horizontal scaling for containerized applications using HPA-tech_solu_125"
],
"Hidden": [
"CommonName"
]
}
}
}その他の例については、「このリソースを含むパブリックテンプレート」をご参照ください。