Tipe resource ALIYUN::CS::ClusterNodePool digunakan untuk membuat kelompok node pada kluster.
Sintaksis
{
"Type": "ALIYUN::CS::ClusterNodePool",
"Properties": {
"TeeConfig": Map,
"ClusterId": String,
"NodePoolInfo": Map,
"KubernetesConfig": Map,
"Count": Integer,
"Management": Map,
"AutoScaling": Map,
"ScalingGroup": Map
}
}Properti
Nama properti | Tipe | Wajib | Pembaruan diizinkan | Deskripsi | Batasan |
ClusterId | String | Ya | Tidak | ID kluster. | Anda dapat memanggil DescribeClustersV1 untuk menanyakan ID kluster. |
ScalingGroup | Map | Ya | Ya | Konfigurasi grup penskalaan untuk kelompok node. | Anda dapat memanggil DescribeClusterNodePools untuk menanyakan konfigurasi grup penskalaan untuk kelompok node. Untuk informasi selengkapnya, lihat Sintaksis ScalingGroup dan Properti ScalingGroup. |
AutoScaling | Map | Tidak | Tidak | Konfigurasi skalabilitas otomatis. | Untuk informasi selengkapnya, lihat Sintaksis AutoScaling dan Properti AutoScaling. |
Count | Integer | Tidak | Ya | Jumlah node dalam kelompok node. | Tidak ada |
KubernetesConfig | Map | Tidak | Ya | Konfigurasi kluster. | Untuk informasi selengkapnya, lihat Sintaksis KubernetesConfig dan Properti KubernetesConfig. |
Management | Map | Tidak | Tidak | Konfigurasi kelompok node terkelola. | Untuk informasi selengkapnya, lihat Sintaksis Management dan Properti Management. |
NodePoolInfo | Map | Tidak | Tidak | Konfigurasi kelompok node. | Untuk informasi selengkapnya, lihat Sintaksis NodePoolInfo dan Properti NodePoolInfo. |
TeeConfig | Map | Tidak | Tidak | Konfigurasi untuk kluster Kubernetes untuk komputasi rahasia. | Untuk informasi selengkapnya, lihat Sintaksis TeeConfig dan Properti TeeConfig. |
Sintaksis TeeConfig
"TeeConfig": {
"TeeEnable": Boolean
}Properti TeeConfig
Nama properti | Tipe | Wajib | Pembaruan diizinkan | Deskripsi | Batasan |
TeeEnable | Boolean | Ya | Tidak | Menentukan apakah akan mengaktifkan kluster Kubernetes untuk komputasi rahasia. | Nilai yang valid:
|
Sintaksis NodePoolInfo
"NodePoolInfo": {
"ResourceGroupId": String,
"Name": String
}Properti NodePoolInfo
Nama properti | Tipe | Wajib | Pembaruan diizinkan | Deskripsi | Batasan |
Name | String | Ya | Tidak | Nama kelompok node. | Tidak ada |
ResourceGroupId | String | Tidak | Tidak | ID kelompok sumber daya tempat kelompok node berada. | Tidak ada |
Sintaksis KubernetesConfig
"KubernetesConfig": {
"CpuPolicy": String,
"Runtime": String,
"CmsEnabled": Boolean,
"UserData": String,
"NodeNameMode": String,
"RuntimeVersion": String,
"Labels": List,
"Unschedulable": Boolean,
"Taints": List
}Properti KubernetesConfig
Nama properti | Jenis | Wajib | Pembaruan diizinkan | Deskripsi | Batasan |
Runtime | String | Ya | Ya | Nama runtime kontainer. | Tidak ada |
RuntimeVersion | String | Ya | Ya | Versi runtime kontainer. | Tidak ada |
CpuPolicy | String | Tidak | Ya | Kebijakan manajemen CPU untuk node. | Properti ini mendukung kebijakan berikut ketika versi kluster adalah 1.12.6 atau lebih baru:
|
CmsEnabled | Boolean | Tidak | Ya | Menentukan apakah akan menginstal Cloud Monitor pada node ECS. | Setelah Anda menginstal Cloud Monitor, Anda dapat melihat metrik pemantauan untuk instance ECS yang dibuat di konsol Cloud Monitor. Kami merekomendasikan agar Anda mengaktifkan fitur ini. Nilai yang valid:
|
NodeNameMode | String | Tidak | Tidak | Nama node kustom. | Nama node terdiri dari tiga bagian: awalan + substring alamat IP node + akhiran.
|
Labels | List | Tidak | Ya | Label untuk node kluster Kubernetes. | Untuk informasi selengkapnya, lihat Sintaksis Labels dan Properti Labels. |
UserData | String | Tidak | Ya | Data kustom untuk node. | Tidak ada |
Unschedulable | Boolean | Tidak | Ya | Menentukan apakah akan menjadwalkan node yang baru ditambahkan. | Nilai yang valid:
|
Taints | List | Tidak | Tidak | Konfigurasi taint. | Untuk informasi selengkapnya, lihat Sintaksis Taints dan Properti Taints. |
Sintaksis Labels
"Labels": [
{
"Value": String,
"Key": String
}
]Properti Labels
Nama properti | Tipe | Wajib | Pembaruan diizinkan | Deskripsi | Batasan |
Value | String | Ya | Ya | Nilai tag. | Tidak ada |
Key | String | Ya | Ya | Kunci tag. | Tidak ada |
Sintaksis Taints
"Taints": [
{
"Value": String,
"Effect": String,
"Key": String
}
]Properti Taints
Nama properti | Tipe | Wajib | Pembaruan diizinkan | Deskripsi | Batasan |
Value | String | Ya | Tidak | Nilai taint. | Tidak ada |
Key | String | Ya | Tidak | Nama taint. | Tidak ada |
Effect | String | Tidak | Tidak | Kebijakan penjadwalan. | Nilai yang valid:
|
Sintaksis Management
"Management": {
"UpgradeConfig": Map,
"AutoRepair": Boolean,
"Enable": Boolean
}Properti Management
Nama properti | Tipe | Wajib | Pembaruan diizinkan | Deskripsi | Batasan |
Enable | Boolean | Ya | Tidak | Menentukan apakah akan mengaktifkan kelompok node terkelola. | Nilai yang valid:
|
AutoRepair | Boolean | Tidak | Tidak | Menentukan apakah akan mengaktifkan perbaikan otomatis. | Parameter ini hanya berlaku ketika Enable diatur ke true. Nilai yang valid:
|
UpgradeConfig | Map | Tidak | Tidak | Konfigurasi untuk peningkatan otomatis. | Properti ini hanya berlaku ketika Enable diatur ke true. Untuk informasi selengkapnya, lihat Sintaksis UpgradeConfig dan Properti UpgradeConfig. |
Sintaksis UpgradeConfig
"UpgradeConfig": {
"AutoUpgrade": Boolean,
"SurgePercentage": Integer,
"Surge": Integer,
"MaxUnavailable": Integer
}Properti UpgradeConfig
Nama properti | Tipe | Wajib | Pembaruan diizinkan | Deskripsi | Batasan |
AutoUpgrade | Boolean | Tidak | Tidak | Menentukan apakah akan mengaktifkan peningkatan otomatis. | Nilai yang valid:
|
SurgePercentage | Integer | Tidak | Tidak | Persentase node tambahan. | Anda dapat menentukan SurgePercentage atau Surge, tetapi tidak keduanya. |
Surge | Integer | Tidak | Tidak | Jumlah node tambahan. | Anda dapat menentukan SurgePercentage atau Surge, tetapi tidak keduanya. |
MaxUnavailable | Integer | Tidak | Tidak | Jumlah maksimum node yang tidak tersedia. | Nilai yang valid: 1 hingga 1000. Nilai default: 1. |
Sintaksis AutoScaling
"AutoScaling": {
"EipBandwidth": Integer,
"Type": String,
"IsBondEip": Boolean,
"MinInstances": Integer,
"Enable": Boolean,
"MaxInstances": Integer,
"EipInternetChargeType": String
}Properti AutoScaling
Nama properti | Jenis | Wajib | Pembaruan diizinkan | Deskripsi | Batasan |
Enable | Boolean | Ya | Tidak | Menentukan apakah akan mengaktifkan skalabilitas otomatis. | Nilai yang valid:
|
EipBandwidth | Integer | Tidak | Tidak | Bandwidth puncak EIP. | Tidak ada |
EipInternetChargeType | String | Tidak | Tidak | Metode penagihan untuk EIP. | Nilai yang valid:
|
IsBondEip | Boolean | Tidak | Tidak | Menentukan apakah akan bind EIP. | Nilai yang valid:
|
MinInstances | Integer | Tidak | Tidak | Jumlah minimum instans dalam grup penskalaan. | Tidak ada |
MaxInstances | Integer | Tidak | Tidak | Jumlah maksimum instans dalam grup penskalaan. | Tidak ada |
Type | String | Tidak | Tidak | Tipe skalabilitas otomatis. | Nilai yang valid (berdasarkan tipe instans):
|
Sintaksis 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
}Properti ScalingGroup
Nama properti | Tipe | Wajib | Pembaruan diizinkan | Deskripsi | Batasan |
InstanceTypes | List | Tidak | Ya | Tipe instans untuk spot instans. | Tidak ada |
SystemDiskSize | Integer | Ya | Ya | Ukuran disk sistem untuk node. | Unit: GiB. Nilai yang valid: 40 hingga 500. |
VSwitchIds | List | Ya | Ya | ID vSwitch. | Tidak ada |
AutoRenew | Boolean | Tidak | Ya | Menentukan apakah akan mengaktifkan perpanjangan otomatis untuk node dalam kelompok node. | Parameter ini hanya berlaku ketika InstanceChargeType diatur ke PrePaid. Nilai yang valid:
|
AutoRenewPeriod | Integer | Tidak | Ya | Periode perpanjangan otomatis untuk node dalam kelompok node. | Parameter ini hanya berlaku ketika InstanceChargeType diatur ke PrePaid dan AutoRenew diatur ke true. Dalam hal ini, AutoRenewPeriod wajib diisi. Ketika PeriodUnit diatur ke Month, nilai yang valid adalah:
|
CompensateWithOnDemand | Boolean | Tidak | Ya | Ketika MultiAzPolicy diatur ke COST_OPTIMIZED, menentukan apakah akan secara otomatis membuat instans sesuai permintaan jika jumlah spot instans yang cukup tidak dapat dibuat karena batasan harga atau inventaris. | Nilai yang valid:
|
DataDisks | List | Tidak | Ya | Konfigurasi disk data untuk node dalam kelompok node. | Untuk informasi selengkapnya, lihat Sintaksis DataDisks dan Properti DataDisks. |
InstanceChargeType | String | Tidak | Ya | Metode penagihan untuk node dalam kelompok node. | Nilai yang valid:
|
ImageId | String | Tidak | Ya | ID gambar kustom. | Gambar yang disediakan sistem digunakan secara default. |
OnDemandPercentageAboveBaseCapacity | Integer | Tidak | Ya | Persentase instans sesuai permintaan di antara instans yang melebihi OnDemandBaseCapacity. | Nilai yang valid: 0 hingga 100. |
OnDemandBaseCapacity | Integer | Tidak | Ya | Jumlah minimum instans sesuai permintaan yang diperlukan dalam grup penskalaan. | Nilai yang valid: 0 hingga 1000. Jika jumlah instans sesuai permintaan kurang dari nilai ini, instans sesuai permintaan diprioritaskan untuk dibuat. |
Platform | String | Tidak | Ya | Sistem operasi. | Nilai yang valid:
|
Period | Integer | Tidak | Ya | Periode perpanjangan otomatis untuk node dalam kelompok node. Parameter ini hanya berlaku ketika Anda memilih langganan dan perpanjangan otomatis. | Ketika PeriodUnit diatur ke Month, nilai yang valid adalah:
|
PeriodUnit | String | Tidak | Ya | Siklus penagihan untuk node dalam kelompok node. | Anda harus menentukan parameter ini ketika InstanceChargeType diatur ke PrePaid. Nilai yang valid:
|
LoginPassword | String | Tidak | Ya | Kata sandi logon SSH. | Anda dapat menentukan KeyPair atau LoginPassword, tetapi tidak keduanya. Persyaratan kata sandi: Harus terdiri dari 8 hingga 30 karakter dan harus mengandung setidaknya tiga dari jenis karakter berikut: huruf Inggris, angka, dan karakter khusus |
MultiAzPolicy | String | Tidak | Ya | Kebijakan penskalaan untuk grup penskalaan multi-zona. | Nilai yang valid:
|
KeyPair | String | Tidak | Ya | Nama pasangan kunci untuk logon tanpa kata sandi. | Anda dapat menentukan KeyPair atau LoginPassword, tetapi tidak keduanya. Catatan Jika Anda membuat kelompok node terkelola, hanya KeyPair yang didukung. |
SecurityGroupId | String | Tidak | Ya | ID grup keamanan. | Tidak ada |
SpotInstanceRemedy | Boolean | Tidak | Ya | Menentukan apakah akan menggunakan spot instans. | Nilai yang valid:
Untuk informasi selengkapnya, lihat Buat spot instans. |
SystemDiskPerformanceLevel | String | Tidak | Ya | Tetapkan tingkat kinerja untuk cloud disk. | Nilai yang valid:
Untuk informasi selengkapnya, lihat Enterprise SSD. |
SpotStrategy | String | Tidak | Ya | Tipe spot instans. | Nilai yang valid:
Untuk informasi selengkapnya, lihat Gunakan spot instans. |
SpotPriceLimit | List | Tidak | Ya | Harga maksimum per jam untuk instans. | Jumlah maksimum tempat desimal adalah 3. Parameter ini hanya berlaku ketika SpotStrategy diatur ke SpotWithPriceLimit. Untuk informasi selengkapnya, lihat Sintaksis SpotPriceLimit dan Properti SpotPriceLimit. |
SpotInstancePools | Integer | Tidak | Ya | Jumlah tipe instans yang tersedia. Grup penskalaan membuat spot instans di seluruh tipe instans ini dengan cara yang dioptimalkan biaya. | Nilai yang valid: 1 hingga 10. |
ScalingPolicy | String | Tidak | Ya | Mode penskalaan untuk grup penskalaan. | Nilai yang valid:
|
SystemDiskCategory | String | Tidak | Ya | Tipe disk sistem untuk node. | Nilai yang valid:
|
InternetChargeType | String | Tidak | Ya | Metode penagihan untuk akses jaringan publik. | Nilai yang valid:
|
InternetMaxBandwidthOut | Integer | Tidak | Ya | Bandwidth publik keluar maksimum. | Unit: Mbit/s. Nilai yang valid: 1 hingga 100 Mbit/s. |
RdsInstances | List | Tidak | Ya | ID instans RDS. | Tidak ada |
Tags | List | Tidak | Ya | Anda hanya dapat menambahkan tag ke instans ECS. | Kunci tag tidak boleh duplikat. Panjang maksimum kunci tag adalah 128 karakter. Kunci dan nilai tag tidak boleh dimulai dengan Untuk informasi selengkapnya, lihat Sintaksis Tags dan Properti Tags. |
ZoneIds | List | Tidak | Ya | ID zona. | Tidak ada |
SocEnabled | Boolean | Tidak | Tidak | Menentukan apakah akan mengaktifkan penguatan keamanan MLPS. | Tidak ada |
ImageType | String | Tidak | Tidak | Tipe gambar sistem operasi. | Anda harus menentukan parameter ini atau parameter Platform. |
InstancePatterns | List | Tidak | Ya | Konfigurasi atribut instans. | Untuk informasi selengkapnya, lihat Properti InstancePatterns. |
SecurityHardeningOs | Boolean | Tidak | Tidak | Penguatan keamanan OS Alibaba Cloud. | Nilai yang valid:
Nilai default: |
Sintaksis InstancePatterns
"InstancePatterns": [
{
"CpuArchitectures": List,
"MaxCpuCores": Integer,
"MinMemorySize": Integer,
"Memory": Integer,
"InstanceFamilyLevel": String,
"MinCpuCores": Integer,
"Cores": Integer,
"InstanceTypeFamilies": List,
"InstanceCategories": List,
"ExcludedInstanceTypes": List,
"MaxMemorySize": Integer
}
]Properti InstancePatterns
Nama properti | Tipe | Wajib | Pembaruan diizinkan | Deskripsi | Batasan |
CpuArchitectures | List | Tidak | Tidak | Arsitektur CPU instans. | Nilai yang valid:
|
MaxCpuCores | Integer | Tidak | Tidak | Jumlah maksimum core vCPU untuk tipe instans. | Tidak ada |
MinMemorySize | Integer | Tidak | Tidak | Ukuran memori minimum untuk tipe instans. | Unit: GiB. |
Memory | Integer | Tidak | Tidak | Ukuran memori untuk tipe instans. | Unit: GiB. |
InstanceFamilyLevel | String | Tidak | Tidak | Tingkat keluarga instans. | Tidak ada |
MinCpuCores | Integer | Tidak | Tidak | Jumlah minimum core vCPU untuk tipe instans. | Tidak ada |
Cores | Integer | Tidak | Tidak | Jumlah core vCPU untuk tipe instans. | Tidak ada |
InstanceTypeFamilies | List | Tidak | Tidak | Keluarga instans yang akan digunakan. | Tidak ada |
InstanceCategories | List | Tidak | Tidak | Klasifikasi instans. | Tidak ada |
ExcludedInstanceTypes | List | Tidak | Tidak | Tipe instans yang dikecualikan. | Tidak ada |
MaxMemorySize | Integer | Tidak | Tidak | Ukuran memori maksimum untuk tipe instans. | Unit: GiB. |
Sintaksis DataDisks
"DataDisks": [
{
"Category": String,
"Encrypted": Boolean,
"PerformanceLevel": String,
"Size": Integer,
"AutoSnapshotPolicyId": String,
"Categories": List
}
]Properti DataDisks
Nama properti | Tipe | Wajib | Pembaruan diizinkan | Deskripsi | Batasan |
AutoSnapshotPolicyId | String | Tidak | Ya | ID kebijakan snapshot otomatis. Disk dicadangkan secara otomatis sesuai kebijakan tersebut. | Nilai default: kosong. Tidak ada pencadangan otomatis yang dilakukan. |
Category | String | Tidak | Ya | Tipe disk data. | Nilai yang valid:
|
Encrypted | Boolean | Tidak | Ya | Menentukan apakah akan mengenkripsi disk data. | Nilai yang valid:
|
PerformanceLevel | String | Tidak | Ya | Tingkat kinerja disk. | Nilai yang valid:
Untuk informasi selengkapnya, lihat Enterprise SSD. |
Size | Integer | Tidak | Ya | Ukuran disk data. | Nilai yang valid: 40 hingga 32768. Nilai default: 120. Unit: GiB. |
Categories | List | Tidak | Tidak | Daftar tipe disk data. | Tidak ada |
Sintaksis SpotPriceLimit
"SpotPriceLimit": [
{
"PriceLimit": Number,
"InstanceType": String
}
]Properti SpotPriceLimit
Nama properti | Tipe | Wajib | Pembaruan diizinkan | Deskripsi | Batasan |
PriceLimit | Number | Ya | Ya | Batas harga instans preemptible. | Tidak ada |
InstanceType | String | Ya | Ya | Tipe instans preemptible. | Tidak ada |
Sintaksis Tags
"Tags": [
{
"Value": String,
"Key": String
}
]Properti Tags
Nama properti | Tipe | Wajib | Pembaruan diizinkan | Deskripsi | Batasan |
Value | String | Ya | Ya | Nilai tag. | Tidak ada |
Key | String | Ya | Ya | Kunci tag. | Tidak ada |
Nilai kembalian
Fn::GetAtt
NodePoolId: ID kelompok node kluster.
Contoh
Contoh 1: Buat kelompok node dengan parameter tetap.
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
TeeConfig:
Type: Json
Description: Konfigurasi komputasi rahasia.
Default: |-
{
"TeeEnable": true
}
ClusterId:
Type: String
Description: ID Kluster.
AssociationProperty: ALIYUN::CS::Cluster::ClusterId
NodePoolInfo:
Type: Json
Description: Konfigurasi kelompok node.
Default: |-
{
"Name": "test"
}
KubernetesConfig:
Type: Json
Description: Konfigurasi kluster 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: Jumlah node dalam kelompok node.
Default: 1
Management:
Type: Json
Description: Konfigurasi kelompok node terkelola.
Default: |-
{
"UpgradeConfig": {
"AutoUpgrade": true,
"Surge": 1,
"MaxUnavailable": 1
},
"AutoRepair": true,
"Enable": true
}
ScalingGroup:
Type: Json
Description: Konfigurasi grup penskalaan yang digunakan oleh kelompok node.
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 kelompok node kluster.
Value:
Fn::GetAtt:
- ClusterNodePool
- NodePoolId
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"TeeConfig": {
"Type": "Json",
"Description": "Konfigurasi komputasi rahasia.",
"Default": "{\n \"TeeEnable\": true\n}"
},
"ClusterId": {
"Type": "String",
"Description": "ID Kluster.",
"AssociationProperty": "ALIYUN::CS::Cluster::ClusterId"
},
"NodePoolInfo": {
"Type": "Json",
"Description": "Konfigurasi kelompok node.",
"Default": "{\n \"Name\": \"test\"\n}"
},
"KubernetesConfig": {
"Type": "Json",
"Description": "Konfigurasi kluster 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": "Jumlah node dalam kelompok node.",
"Default": 1
},
"Management": {
"Type": "Json",
"Description": "Konfigurasi kelompok node terkelola.",
"Default": "{\n \"UpgradeConfig\": {\n \"AutoUpgrade\": true,\n \"Surge\": 1,\n \"MaxUnavailable\": 1\n },\n \"AutoRepair\": true,\n \"Enable\": true\n}"
},
"ScalingGroup": {
"Type": "Json",
"Description": "Konfigurasi grup penskalaan yang digunakan oleh kelompok node.",
"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 kelompok node kluster.",
"Value": {
"Fn::GetAtt": [
"ClusterNodePool",
"NodePoolId"
]
}
}
}
}Contoh 2: Buat kelompok node dengan parameter dinamis.
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: Availability Zone
zh-cn: Availability Zone 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: Availability Zone
zh-cn: Availability Zone 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: Instance Type
zh-cn: Instance Type
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: >-
Kata sandi logon server. Kata sandi harus terdiri dari 8 hingga 30 karakter dan mengandung karakter dari minimal tiga kategori berikut: huruf kapital, huruf kecil, angka, dan karakter khusus dari himpunan berikut: ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/
Label:
en: Instance Password
zh-cn: Instance Password
ConstraintDescription:
en: >-
Length 8-30, must contain three(Capital letters, lowercase letters,
numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in)
zh-cn: 'Kata sandi harus terdiri dari 8 hingga 30 karakter dan mengandung karakter dari minimal tiga kategori berikut: huruf kapital, huruf kecil, angka, dan karakter khusus dari himpunan berikut: ()`~!@#$%^&*_-+=|{}[]:;''<>,.?/'
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: Titik akhir layanan coffee.
en: The addresses of coffee service.
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": "Zona Ketersediaan",
"zh-cn": "Zone 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": "Zona Ketersediaan",
"zh-cn": "Zone 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": "Tipe Instans",
"zh-cn": "Instance Type"
}
},
"InstancePassword": {
"NoEcho": true,
"Type": "String",
"Description": {
"en": "Kata sandi login server, Panjang 8-30, harus berisi tiga dari jenis berikut: Huruf besar, huruf kecil, angka, dan simbol khusus ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/",
"zh-cn": "Server logon password. The password must be 8 to 30 characters in length and contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters: ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/"
},
"Label": {
"en": "Kata Sandi Instans",
"zh-cn": "Instance Password"
},
"ConstraintDescription": {
"en": "Panjang 8-30, harus berisi tiga dari jenis berikut: Huruf besar, huruf kecil, angka, dan simbol khusus ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/",
"zh-cn": "The password must be 8 to 30 characters in length and contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters: ()`~!@#$%^&*_-+=|{}[]:;''<>,.?/"
},
"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": "The endpoint of the coffee service.",
"en": "Alamat layanan coffee."
},
"Value": {
"Ref": "NodePools"
}
}
},
"Metadata": {
"ALIYUN::ROS::Interface": {
"ParameterGroups": [
{
"Parameters": [
"ClusterId",
"VpcId",
"ZoneId1",
"VSwitchId1",
"ZoneId2",
"VSwitchId2",
"InstanceType",
"InstancePassword"
]
}
]
}
}
}Contoh 3: Buat kluster Kubernetes terkelola dan konfigurasikan VPC serta kelompok node.
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: Buat kluster Kubernetes terkelola, konfigurasikan VPC, kelompok node, Horizontal Pod Autoscaler (HPA), dan Simple Log Service untuk mengaktifkan penskalaan otomatis dan pemantauan untuk aplikasi berkontainer.
en: Create a managed Kubernetes cluster, configure Virtual Private Cloud (VPC),
node pools, Horizontal Pod Autoscaler (HPA), and logging services to enable automatic
scaling and monitoring of containerized applications.
Parameters:
CommonName:
Type: String
Default: k8s-hpa-cluster
SlsProjectName:
Type: String
Label:
en: Name of sls project
zh-cn: Nama proyek SLS
Description:
en: The name contains 3 to 36 characters. It must start and end with a lowercase letter or number. The value can contain lowercase letters, digits, and hyphens (-).
zh-cn: Nama harus terdiri dari 3 hingga 36 karakter. Nama harus dimulai dan diakhiri dengan huruf kecil atau angka. Nama dapat berisi huruf kecil, angka, dan tanda hubung (-).
AssociationProperty: AutoCompleteInput
AssociationPropertyMetadata:
Length: 5
Prefix: k8s-hpa-sls-project-
CharacterClasses:
- Class: lowercase
min: 1
ManagedKubernetesClusterName:
Type: String
Label:
en: Managed Kubernetes Cluster Name
zh-cn: Nama kluster ACK yang dikelola
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: Zone 1
ZoneId2:
Type: String
AssociationProperty: 'ALIYUN::ECS::Instance::ZoneId'
AssociationPropertyMetadata:
ExclusiveTo:
- ZoneId1
Label:
en: Availability Zone
zh-cn: Zone 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: Instance Type
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: >-
Kata sandi logon server. Kata sandi harus terdiri dari 8 hingga 30 karakter dan mengandung minimal tiga dari jenis karakter berikut: huruf kapital, huruf kecil, angka, dan karakter khusus: ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/
Label:
en: Instance Password
zh-cn: Instance Password
ConstraintDescription:
en: >-
Length 8-30, must contain three(Capital letters, lowercase letters,
numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in)
zh-cn: 'Kata sandi harus terdiri dari 8 hingga 30 karakter dan mengandung minimal tiga dari jenis karakter berikut: huruf kapital, huruf kecil, angka, dan karakter khusus: ()`~!@#$%^&*_-+=|{}[]:;''<>,.?/'
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 menggunakan role ini untuk mengakses sumber daya Anda di layanan Alibaba Cloud lainnya.
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: Titik akhir layanan tea.
en: The addresses of tea service.
Value:
'Fn::Sub': http://${IngressInfo}/tea
CoffeeUrl:
Description:
zh-cn: Titik akhir layanan coffee.
en: The addresses of coffee service.
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": "Buat kluster Kubernetes terkelola, konfigurasikan VPC, kelompok node, Horizontal Pod Autoscaler (HPA), dan Simple Log Service untuk mengaktifkan penskalaan otomatis dan pemantauan untuk aplikasi berkontainer.",
"en": "Create a managed Kubernetes cluster, configure Virtual Private Cloud (VPC), node pools, Horizontal Pod Autoscaler (HPA), and logging services to enable automatic scaling and monitoring of containerized applications."
},
"Parameters": {
"CommonName": {
"Type": "String",
"Default": "k8s-hpa-cluster"
},
"SlsProjectName": {
"Type": "String",
"Label": {
"en": "Name of sls project",
"zh-cn": "Nama proyek SLS"
},
"Description": {
"en": "The name contains 3 to 36 characters. It must start and end with a lowercase letter or number. The value can contain lowercase letters, digits, and hyphens (-).",
"zh-cn": "Nama harus terdiri dari 3 hingga 36 karakter. Nama harus dimulai dan diakhiri dengan huruf kecil atau angka. Nama dapat berisi huruf kecil, angka, dan tanda hubung (-)."
},
"AssociationProperty": "AutoCompleteInput",
"AssociationPropertyMetadata": {
"Length": 5,
"Prefix": "k8s-hpa-sls-project-",
"CharacterClasses": [
{
"Class": "lowercase",
"min": 1
}
]
}
},
"ManagedKubernetesClusterName": {
"Type": "String",
"Label": {
"en": "Managed Kubernetes Cluster Name",
"zh-cn": "Nama kluster ACK yang dikelola"
},
"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": "Zone 1"
}
},
"ZoneId2": {
"Type": "String",
"AssociationProperty": "ALIYUN::ECS::Instance::ZoneId",
"AssociationPropertyMetadata": {
"ExclusiveTo": [
"ZoneId1"
]
},
"Label": {
"en": "Availability Zone",
"zh-cn": "Zone 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": "Instance Type"
}
},
"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": "Kata sandi logon server. Kata sandi harus terdiri dari 8 hingga 30 karakter dan mengandung minimal tiga dari jenis karakter berikut: huruf kapital, huruf kecil, angka, dan karakter khusus: ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/"
},
"Label": {
"en": "Instance Password",
"zh-cn": "Instance Password"
},
"ConstraintDescription": {
"en": "Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in)",
"zh-cn": "Kata sandi harus terdiri dari 8 hingga 30 karakter dan mengandung minimal tiga dari jenis karakter berikut: huruf kapital, huruf kecil, angka, dan karakter khusus: ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/"
},
"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 menggunakan role ini untuk mengakses sumber daya Anda di layanan Alibaba Cloud lainnya.",
"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": "Titik akhir layanan tea.",
"en": "The addresses of tea service."
},
"Value": {
"Fn::Sub": "http://${IngressInfo}/tea"
}
},
"CoffeeUrl": {
"Description": {
"zh-cn": "Titik akhir layanan coffee.",
"en": "The addresses of coffee service."
},
"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"
]
}
}
}Untuk contoh lainnya, lihat Templat publik yang berisi resource ini.