O recurso ALIYUN::CS::ManagedKubernetesCluster cria clusters Kubernetes gerenciados pelo ACK.
Sintaxe
{
"Type": "ALIYUN::CS::ManagedKubernetesCluster",
"Properties": {
"CloudMonitorFlags": Boolean,
"ProxyMode": String,
"SnatEntry": Boolean,
"VpcId": String,
"Tags": List,
"LoginPassword": String,
"ContainerCidr": String,
"Name": String,
"Taint": List,
"KeyPair": String,
"Addons": List,
"AutoMode": Map,
"ServiceCidr": String,
"KubernetesVersion": String,
"SecurityGroupId": String,
"EndpointPublicAccess": Boolean,
"RrsaConfig": Map,
"ClusterSpec": String,
"TimeoutMins": Number,
"PodVswitchIds": List,
"EncryptionProviderKey": String,
"Runtime": Map,
"SocEnabled": Boolean,
"UserData": String,
"OsType": String,
"IsEnterpriseSecurityGroup": Boolean,
"Platform": String,
"LoadBalancerSpec": String,
"FormatDisk": Boolean,
"NodeCidrMask": String,
"KeepInstanceName": Boolean,
"DeletionProtection": Boolean,
"ResourceGroupId": String,
"NodePools": List,
"NodeNameMode": String,
"SecurityHardeningOs": Boolean,
"DeleteOptions": List,
"ControlPlaneLogComponents": List,
"ControlPlaneLogTtl": Number,
"ControlPlaneLogProject": String,
"MaintenanceWindow": Map,
"ZoneIds": List,
"VSwitchIds": List,
"TimeZone": String,
"IpStack": String
}
}
Propriedades
Propriedade | Tipo | Obrigatório | Atualizável | Descrição | Restrições |
Name | String | Sim | Não | Nome do cluster. | Comprimento: 1 a 63 caracteres. Pode conter letras, caracteres chineses, números e hifens (-). |
VpcId | String | Sim | Não | ID da Virtual Private Cloud (VPC). | Se não for definido, o sistema cria automaticamente uma VPC com o bloco CIDR 192.168.0.0/16. Defina tanto |
VSwitchIds | List | Sim | Não | vSwitches vinculados aos nós de trabalho. | Nenhuma |
Addons | List | Não | Sim | Plugins de complemento para o cluster. | Valores:
Para mais informações, consulte Addons properties. |
AutoMode | Map | Não | Não | Configuração de gerenciamento inteligente. | Para mais informações, consulte AutoMode properties. |
CloudMonitorFlags | Boolean | Não | Não | Instala o agente do CloudMonitor. | Valores:
|
ClusterSpec | String | Não | Não | Tipo do cluster gerenciado pelo ACK. | Valores:
|
ContainerCidr | String | Não | Não | Bloco CIDR do contêiner. | Não pode entrar em conflito com o bloco CIDR da VPC. Se o sistema criar uma VPC automaticamente, ele usará o bloco CIDR 172.16.0.0/16 por padrão. |
ControlPlaneLogComponents | List | Não | Sim | Lista de nomes dos componentes. | Especifica quais logs de componentes do plano de controle devem ser coletados. Coleta logs dos componentes apiserver, kcm e scheduler por padrão. |
ControlPlaneLogProject | String | Não | Sim | Projeto do Simple Log Service para logs de componentes do plano de controle. | Use um projeto existente para armazenamento de logs ou permita que o sistema crie um automaticamente. Se você optar pela criação automática, o sistema criará um projeto do Simple Log Service chamado |
ControlPlaneLogTtl | Number | Não | Sim | Número de dias para reter logs de componentes do plano de controle. | Nenhuma |
DeleteOptions | List | Não | Sim | Opções de exclusão para recursos associados ao cluster. | Para mais informações, consulte DeleteOptions properties. |
DeletionProtection | Boolean | Não | Sim | Ativa a proteção contra exclusão. | Se ativada, impede a exclusão direta do cluster. Valores:
|
EncryptionProviderKey | String | Não | Não | ID da chave gerenciada pelo Key Management Service (KMS). | Esta chave criptografa discos de dados. Use o KMS apenas em clusters Kubernetes gerenciados profissionais. |
EndpointPublicAccess | Boolean | Não | Não | Ativa o acesso à rede pública para o servidor de API. | Valores:
|
FormatDisk | Boolean | Não | Não | Indica se discos de dados devem ser montados nos nós de instâncias ECS existentes. | Valores:
|
IpStack | String | Não | Não | Pilha de protocolos IP do cluster. | Valores:
|
IsEnterpriseSecurityGroup | Boolean | Não | Não | Cria um grupo de segurança avançado. | Este parâmetro entra em vigor quando SecurityGroupId está vazio. Valores:
|
KeepInstanceName | Boolean | Não | Não | Mantém os nomes das instâncias ECS existentes usadas no cluster. | Valores:
|
KeyPair | String | Não | Não | Nome do par de chaves. | Especifique KeyPair ou LoginPassword. |
KubernetesVersion | String | Não | Sim | Versão do Kubernetes para o cluster, alinhada com a base da comunidade. Recomendamos selecionar a versão mais recente. | É possível criar clusters das duas versões mais recentes. Para mais informações sobre as versões do Kubernetes suportadas pelo ACK, consulte Kubernetes Version Release Overview (Offline). |
LoadBalancerSpec | String | Não | Não | Tipo da instância SLB. | Valores:
|
LoginPassword | String | Não | Não | Senha de login SSH. | Comprimento: 8 a 30 caracteres. Deve incluir letras, números e caracteres especiais. Os caracteres especiais suportados são Nota Especifique LoginPassword ou KeyPair. |
MaintenanceWindow | Map | Não | Sim | Configuração da janela de manutenção do cluster. | Para mais informações, consulte MaintenanceWindow properties. |
NodeCidrMask | String | Não | Não | Número máximo de endereços IP atribuíveis a um nó. | O número depende do CIDR de pod especificado. Este parâmetro se aplica apenas quando o cluster usa o plugin Flannel. Padrão: 25. |
NodeNameMode | String | Não | Não | Personaliza os nomes dos nós. | Os nomes dos nós consistem em três partes: prefixo + substring do endereço IP do nó + sufixo.
Por exemplo, se o endereço IP do nó for 192.168.XX.XX, o prefixo for |
NodePools | List | Não | Não | Informações do pool de nós. | Para mais informações, consulte NodePools properties. |
OsType | String | Não | Não | Tipo do sistema operacional. | Valores:
|
Platform | String | Não | Não | Versão de lançamento do sistema operacional. | Valores:
|
PodVswitchIds | List | Não | Não | Lista de vSwitches de Pod. | Especifique pelo menos um vSwitch de Pod na mesma zona para cada vSwitch de nó. O vSwitch de Pod não pode ser igual ao vSwitch de nó. Escolha vSwitches com máscara de bloco CIDR não superior a 19. Nota Quando a lista de complementos (Addons) estiver definida para componentes de rede e o tipo de rede Terway for usado, você deve especificar PodVswitchIds para o cluster. |
ProxyMode | String | Não | Não | Modo do kube-proxy. | Valores:
|
ResourceGroupId | String | Não | Sim | ID do grupo de recursos ao qual o cluster pertence. | Nenhuma |
RrsaConfig | Map | Não | Não | Configuração RRSA. | Para mais informações, consulte RrsaConfig properties. |
Runtime | Map | Não | Não | Runtime do contêiner. | Runtime inclui as seguintes duas informações:
Exemplo: Para mais informações sobre como selecionar um runtime de contêiner, consulte Comparison of containerd, sandboxed containers, and Docker runtimes. Para mais informações, consulte Runtime properties. |
SecurityGroupId | String | Não | Não | ID do grupo de segurança ao qual as instâncias ECS do cluster pertencem. | Nenhuma |
SecurityHardeningOs | Boolean | Não | Não | Reforço de segurança do sistema operacional Alibaba Cloud. | Valores:
Padrão: false. |
ServiceCidr | String | Não | Não | Bloco CIDR de serviço. | Não pode entrar em conflito com o bloco CIDR da VPC ou com o bloco CIDR do contêiner. Se o sistema criar uma VPC automaticamente, ele usará o bloco CIDR 172.19.0.0/20 por padrão. |
SnatEntry | Boolean | Não | Não | Indica se SNAT deve ser configurado para a rede. | Valores:
|
SocEnabled | Boolean | Não | Não | Ativa o reforço de proteção em camadas. | Valores:
|
Tags | List | Não | Sim | Tags do cluster. | Configure até 20 grupos de tags. Para mais informações, consulte Tags properties. |
Taint | List | Não | Não | Aplica taints aos nós, geralmente para políticas de agendamento de Pods. | Se um Pod tiver uma tolerância que corresponda ao taint de um nó, ele poderá ser agendado nesse nó. |
TimeoutMins | Number | Não | Não | Tempo limite para criação do cluster. | Padrão: 60. Unidade: minutos. |
TimeZone | String | Não | Não | Fuso horário do cluster. | Nenhuma |
UserData | String | Não | Não | Dados de usuário passados durante a criação de instâncias ECS. | O conteúdo deve ter no máximo 16 KB. Não é necessária codificação Base64. Use caracteres de escape para caracteres especiais. |
ZoneIds | List | Não | Não | Lista de zonas. | Nenhuma |
Sintaxe de NodePools
"NodePools": [
{
"ScalingGroup": Map,
"KubernetesConfig": Map,
"NodePoolInfo": Map
}
]
Propriedades de NodePools
|
Propriedade |
Tipo |
Obrigatório |
Atualizável |
Descrição |
Restrições |
|
ScalingGroup |
Map |
Sim |
Não |
Configuração do grupo de dimensionamento do pool de nós. |
Para mais informações, consulte ScalingGroup properties. |
|
KubernetesConfig |
Map |
Não |
Não |
Configuração relacionada ao cluster. |
Para mais informações, consulte KubernetesConfig properties. |
|
NodePoolInfo |
Map |
Não |
Não |
Configuração do pool de nós. |
Para mais informações, consulte NodePoolInfo properties. |
Sintaxe de ScalingGroup
"ScalingGroup": {
"InstancePatterns": List,
"SocEnabled": Boolean,
"ImageType": String,
"SecurityHardeningOs": Boolean,
"RdsInstances": List,
"IsEnterpriseSecurityGroup": Boolean,
"VSwitchIds": List,
"InternetMaxBandwidthOut": Integer,
"DataDisks": List,
"Period": Integer,
"InternetChargeType": String,
"KeyPair": String,
"SystemDiskPerformanceLevel": String,
"ImageId": String,
"InstanceTypes": List,
"SystemDiskCategory": String,
"PeriodUnit": String,
"LoginPassword": String,
"InstanceChargeType": String,
"SystemDiskSize": Integer,
"Tags": List,
"ZoneIds": List,
"DesiredSize": Integer
}
Propriedades de ScalingGroup
Propriedade | Tipo | Obrigatório | Atualizável | Descrição | Restrições |
SystemDiskSize | Integer | Sim | Não | Tamanho do disco de sistema do nó. | Unidade: GiB. Intervalo: 40 a 500. |
DataDisks | List | Não | Não | Configuração do disco de dados do pool de nós. | Para mais informações, consulte DataDisks properties. |
DesiredSize | Integer | Não | Não | Número desejado de nós no pool de nós. | Nenhuma |
ImageId | String | Não | Não | ID da imagem personalizada. | Usa a imagem fornecida pelo sistema por padrão. |
ImageType | String | Não | Não | Tipo de imagem do sistema operacional. | Nenhuma |
InstanceChargeType | String | Não | Não | Método de faturamento dos nós do pool de nós. | Valores:
|
InstancePatterns | List | Não | Não | Configuração das propriedades da instância. | Para mais informações, consulte InstancePatterns properties. |
InstanceTypes | List | Não | Não | Tipos de instância. | Nenhuma |
InternetChargeType | String | Não | Não | Método de faturamento para endereços IP públicos. | Valores:
|
InternetMaxBandwidthOut | Integer | Não | Não | Largura de banda de saída máxima para o endereço IP público do nó. | Unidade: Mbps. Intervalo: 1 a 100. |
IsEnterpriseSecurityGroup | Boolean | Não | Não | Cria automaticamente um grupo de segurança de nível empresarial. | Valores:
|
KeyPair | String | Não | Não | Nome do par de chaves para login sem senha. | Escolha entre a propriedade KeyPair ou LoginPassword. |
LoginPassword | String | Não | Não | Senha de login SSH. | Escolha entre KeyPair ou LoginPassword. Regras de senha: 8 a 30 caracteres, deve incluir letras maiúsculas, letras minúsculas, números e caracteres especiais. |
Period | Integer | Não | Não | Duração da assinatura dos nós do pool de nós. | Esta propriedade se aplica e é obrigatória quando InstanceChargeType está definido como PrePaid. Quando period_unit está definido como Month, intervalo de period: {1, 2, 3, 6, 12}. Padrão: 1. |
PeriodUnit | String | Não | Não | Ciclo de faturamento dos nós do pool de nós. | Especifique o período quando InstanceChargeType estiver definido como PrePaid. Month: Unidade de tempo equivalente a um mês civil. |
RdsInstances | List | Não | Não | ID da instância ApsaraDB RDS. | Nenhuma |
SecurityHardeningOs | Boolean | Não | Não | Reforço de segurança do Alibaba Cloud OS. | Valores:
Padrão: |
SocEnabled | Boolean | Não | Não | Ativa o reforço de proteção em camadas. | Valores:
|
SystemDiskCategory | String | Não | Não | Tipo do disco de sistema do nó. | Valores:
|
SystemDiskPerformanceLevel | String | Não | Não | Nível de desempenho do disco de sistema do nó. | Aplica-se apenas a discos ESSD. |
Tags | List | Não | Não | Adiciona tags apenas às instâncias ECS. | Para mais informações, consulte Tags properties. |
VSwitchIds | List | Não | Não | Lista de IDs de vSwitch. | Nenhuma |
ZoneIds | List | Não | Não | Lista de zonas. | Nenhuma |
Sintaxe de DataDisks
"DataDisks": [
{
"AutoSnapshotPolicyId": String,
"Encrypted": Boolean,
"Size": Integer,
"Category": String,
"PerformanceLevel": String,
"Categories": List
}
]
Propriedades de DataDisks
Propriedade | Tipo | Obrigatório | Atualizável | Descrição | Restrições |
AutoSnapshotPolicyId | String | Não | Não | Selecione o ID da política de snapshot automático. | Os discos cloud são submetidos a backup automaticamente conforme a política de snapshot. |
Categories | List | Não | Não | Lista de tipos de disco de dados. | Nenhuma |
Category | String | Não | Não | Tipo do disco de dados. | Valores:
|
Encrypted | Boolean | Não | Não | Indica se o disco de dados deve ser criptografado. | Valores:
|
PerformanceLevel | String | Não | Não | Nível de desempenho do disco de dados do nó. | Aplica-se apenas a discos ESSD. O nível de desempenho do disco está relacionado ao tamanho do disco. Para mais informações, consulte enterprise SSD. |
Size | Integer | Não | Não | Tamanho do disco de dados. | Unidade: GiB. Intervalo: 40 a 32768. Padrão: 120. |
Sintaxe de KubernetesConfig
"KubernetesConfig": {
"Runtime": String,
"RuntimeVersion": String,
"CpuPolicy": String,
"Labels": List,
"NodeNameMode": String,
"Taints": List
}
Propriedades de KubernetesConfig
Propriedade | Tipo | Obrigatório | Atualizável | Descrição | Restrições |
Runtime | String | Sim | Não | Runtime de contêiner. | Nenhuma |
RuntimeVersion | String | Sim | Não | Versão do runtime de contêiner. | Nenhuma |
CpuPolicy | String | Não | Não | Política de gerenciamento de CPU do nó. | As duas políticas a seguir são suportadas quando a versão do cluster é 1.12.6 ou posterior:
|
Labels | List | Não | Não | Rótulos do nó. | Adicione rótulos aos nós do cluster Kubernetes. Para mais informações, consulte Labels properties. |
NodeNameMode | String | Não | Não | Personaliza os nomes dos nós. | Os nomes dos nós consistem em três partes: prefixo + substring do endereço IP do nó + sufixo.
Por exemplo, se o endereço IP do nó for 192.168.XX.XX, o prefixo for |
Taints | List | Não | Não | Configuração de taints. | Para mais informações, consulte Taints properties. |
Sintaxe de RrsaConfig
"RrsaConfig":
{
"Enabled": Boolean
}
Propriedades de RrsaConfig
Propriedade | Tipo | Obrigatório | Permite Atualizações | Descrição | Restrições |
Enabled | Boolean | Sim | Não | Ativa o recurso RAM role for service account (RRSA). | Valores:
|
Sintaxe de InstancePatterns
"InstancePatterns": [
{
"CpuArchitectures": List,
"MaxCpuCores": Integer,
"MinMemorySize": Integer,
"Memory": Integer,
"InstanceFamilyLevel": String,
"MinCpuCores": Integer,
"Cores": Integer,
"InstanceTypeFamilies": List,
"InstanceCategories": List,
"ExcludedInstanceTypes": List,
"MaxMemorySize": Integer
}
]
Propriedades de InstancePatterns
Propriedade | Tipo | Obrigatório | Atualizável | Descrição | Restrições |
Cores | Integer | Não | Não | Número de núcleos vCPU para o tipo de instância. | Nenhuma |
CpuArchitectures | List | Não | Não | Arquitetura de CPU da instância. | Valores:
|
ExcludedInstanceTypes | List | Não | Não | Tipos de instância a serem excluídos. | Nenhuma |
InstanceCategories | List | Não | Não | Categorização da instância. | Nenhuma |
InstanceFamilyLevel | String | Não | Não | Nível da família de instâncias. | Nenhuma |
InstanceTypeFamilies | List | Não | Não | Especifique a família da instância. | Nenhuma |
MaxCpuCores | Integer | Não | Não | Número máximo de núcleos vCPU para o tipo de instância. | Nenhuma |
MaxMemorySize | Integer | Não | Não | Tamanho máximo de memória para o tipo de instância. | Unidade: GiB. |
Memory | Integer | Não | Não | Tamanho de memória para o tipo de instância. | Unidade: GiB. |
MinCpuCores | Integer | Não | Não | Número mínimo de núcleos vCPU para o tipo de instância. | Nenhuma |
MinMemorySize | Integer | Não | Não | Tamanho mínimo de memória para o tipo de instância. | Unidade: GiB. |
Sintaxe de AutoMode
"AutoMode": {
"Enable": Boolean
}
Propriedades de AutoMode
|
Propriedade |
Tipo |
Obrigatório |
Atualizável |
Descrição |
Restrições |
|
Enable |
Boolean |
Sim |
Não |
Indica se o modo de gerenciamento inteligente deve ser ativado. |
Nenhuma |
Sintaxe de Labels
"Labels": {
"Value": String,
"Key": String
}
Propriedades de Labels
|
Propriedade |
Tipo |
Obrigatório |
Atualizável |
Descrição |
Restrições |
|
Key |
String |
Sim |
Não |
Chave da tag. |
Nenhuma |
|
Value |
String |
Sim |
Não |
Valor da tag. |
Nenhuma |
Sintaxe de Taints
"Taints": [{
"Value": String,
"Effect": String,
"Key": String
}]
Propriedades de Taints
Propriedade | Tipo | Obrigatório | Atualizável | Descrição | Restrições |
Key | String | Sim | Não | Nome do taint. | Nenhuma |
Value | String | Sim | Não | Valor do taint. | Nenhuma |
Effect | String | Não | Não | Política de agendamento. |
|
Sintaxe de NodePoolInfo
"NodePoolInfo": {
"Name": String,
"Type": String,
"ResourceGroupId": String
}
Propriedades de NodePoolInfo
Propriedade | Tipo | Obrigatório | Atualizável | Descrição | Restrições |
Name | String | Sim | Não | Nome do pool de nós. | Nenhuma |
ResourceGroupId | String | Não | Sim | Grupo de recursos ao qual o pool de nós pertence. | Nenhuma |
Type | String | Não | Não | Tipo do pool de nós. | Valores:
|
Sintaxe de MaintenanceWindow
"MaintenanceWindow": {
"Enable": Boolean,
"MaintenanceTime": String,
"Duration": String,
"WeeklyPeriod": String,
"Recurrence": String
}
Propriedades de MaintenanceWindow
Propriedade | Tipo | Obrigatório | Atualizável | Descrição | Restrições |
Duration | String | Não | Sim | Duração da manutenção. | Intervalo: [1, 24]. Unidade: horas. Padrão: 3h. |
Enable | Boolean | Não | Sim | Ativa a janela de manutenção. | Valores:
Padrão: |
MaintenanceTime | String | Não | Sim | Horário de início da manutenção. | Formato padrão RFC3339. |
Recurrence | String | Não | Sim | Regra de recorrência para a janela de manutenção, definida com a sintaxe de Regra de Recorrência RFC5545. | Atualmente suporta apenas FREQ=WEEKLY. Não permite especificar COUNT ou UNTIL. |
WeeklyPeriod | String | Não | Sim | Período de manutenção. | Separe múltiplos valores com vírgulas (,). Valores: {Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday} Padrão: |
Sintaxe de Tags
"Tags": [
{
"Key": String,
"Value": String
}
]
Propriedades de Tags
|
Nome da Propriedade |
Tipo |
Obrigatório |
Atualizável |
Descrição |
Restrições |
|
Key |
String |
Sim |
Não |
Chave da tag. |
Tamanho: 1 a 64 caracteres. Não pode começar com |
|
Value |
String |
Sim |
Não |
Valor da tag. |
Tamanho: 0 a 128 caracteres. Não pode começar com |
Sintaxe de Addons
"Addons": [
{
"Version": String,
"Config": String,
"Name": String,
"Disabled": Boolean
}
]
Propriedades de Addons
Nome da Propriedade | Tipo | Obrigatório | Atualizável | Descrição | Restrições |
Name | String | Sim | Não | Nome do plugin do Addon. | Nenhuma |
Config | String | Não | Sim | Configuração do plugin do Addon. | Nenhuma |
Disabled | Boolean | Não | Não | Indica se a instalação padrão deve ser desativada. | Valores:
|
Version | String | Não | Não | Versão do plugin do Addon. | Utiliza a versão mais recente por padrão. |
Sintaxe de DeleteOptions
"DeleteOptions": [
{
"DeleteMode": String,
"ResourceType": String
}
]
Propriedades de DeleteOptions
Nome da Propriedade | Tipo | Obrigatório | Atualizável | Descrição | Restrições |
DeleteMode | String | Não | Sim | Política de exclusão para este tipo de recurso. | Valores:
|
ResourceType | String | Não | Sim | Tipo de recurso. | Valores:
|
Sintaxe de Runtime
"Runtime": {
"Name": String,
"Version": String
}
Propriedades de Runtime
Nome da Propriedade | Tipo | Obrigatório | Atualizável | Descrição | Restrições |
Name | String | Sim | Não | Nome do runtime de contêiner. | O ACK oferece suporte aos três runtimes de contêiner abaixo.
Padrão: |
Version | String | Não | Não | Versão do runtime de contêiner. | Usa a versão mais recente por padrão. Para mais informações, consulte Sandboxed Container Runtime Release Notes. |
Valores de Retorno
Fn::GetAtt
ClusterId: ID do cluster.
TaskId: ID da tarefa. O sistema atribui esse valor automaticamente para permitir que os usuários consultem o status da tarefa.
DefaultUserKubeConfig: Configuração padrão do Kubernetes para credenciais de usuário do cluster.
ScalingRuleId: ID da regra de dimensionamento.
ScalingGroupId: ID do grupo de dimensionamento.
PrivateUserKubConfig: Configuração privada do Kubernetes para credenciais de usuário do cluster.
ScalingConfigurationId: ID da configuração de dimensionamento.
Nodes: Lista de nós do cluster.
APIServerSLBId: ID do Load Balancer do servidor de API.
IngressSLBId: ID do Server Load Balancer de Ingress.
WorkerRamRoleName: Nome da função RAM do worker.
Exemplos
Cenário 1: Criar um cluster gerenciado do ACK.
ROSTemplateFormatVersion: '2015-09-01'
Description: Test Create ManagedKubernetesCluster
Parameters: {}
Resources:
Vpc:
Type: ALIYUN::ECS::VPC
Properties:
VpcName: mytest
CidrBlock: 192.168.0.0/16
VSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
VSwitchName: mytest
VpcId:
Ref: Vpc
ZoneId:
Fn::Select:
- '0'
- Fn::GetAZs:
Ref: ALIYUN::Region
CidrBlock: 192.168.1.0/24
ManagedKubernetesCluster:
Type: ALIYUN::CS::ManagedKubernetesCluster
Properties:
VSwitchIds:
- Ref: VSwitch
VpcId:
Ref: Vpc
ClusterSpec: ack.pro.small
LoginPassword: Admin@123!
Name: mytest
Outputs:
ClusterId:
Value:
Fn::GetAtt:
- ManagedKubernetesCluster
- ClusterId
TaskId:
Value:
Fn::GetAtt:
- ManagedKubernetesCluster
- TaskId {
"ROSTemplateFormatVersion": "2015-09-01",
"Description": "Test Create ManagedKubernetesCluster",
"Parameters": {
},
"Resources": {
"Vpc": {
"Type": "ALIYUN::ECS::VPC",
"Properties": {
"VpcName": "mytest",
"CidrBlock": "192.168.0.0/16"
}
},
"VSwitch": {
"Type": "ALIYUN::ECS::VSwitch",
"Properties": {
"VSwitchName": "mytest",
"VpcId": {
"Ref": "Vpc"
},
"ZoneId": {
"Fn::Select": [
"0",
{
"Fn::GetAZs": {
"Ref": "ALIYUN::Region"
}
}
]
},
"CidrBlock": "192.168.1.0/24"
}
},
"ManagedKubernetesCluster": {
"Type": "ALIYUN::CS::ManagedKubernetesCluster",
"Properties": {
"VSwitchIds": [
{
"Ref": "VSwitch"
}
],
"VpcId": {
"Ref": "Vpc"
},
"ClusterSpec": "ack.pro.small",
"LoginPassword": "Admin@123!",
"Name": "mytest"
}
}
},
"Outputs": {
"ClusterId": {
"Value": {
"Fn::GetAtt": [
"ManagedKubernetesCluster",
"ClusterId"
]
}
},
"TaskId": {
"Value": {
"Fn::GetAtt": [
"ManagedKubernetesCluster",
"TaskId"
]
}
}
}
}Cenário 2: Criar um cluster dedicado do ACK (em uma VPC).
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: Configure billing methods on the existing VPC, vSwitches, and security groups. Then, create a Kubernetes cluster that includes worker nodes, network settings, and monitoring plugins.
en: Configure billing methods on the existing VPC, switches, and security groups, then proceed to create a Kubernetes cluster inclusive of worker nodes, network configurations, and monitoring plugins.
Parameters:
PayType:
Type: String
Label:
en: ECS Instance Charge Type
zh-cn: ECS Instance Charge Type
AssociationProperty: ChargeType
AssociationPropertyMetadata:
LocaleKey: InstanceChargeType
Default: PostPaid
AllowedValues:
- PostPaid
- PrePaid
PayPeriodUnit:
Type: String
Label:
en: Pay Period Unit
zh-cn: Pay Period Unit
AssociationProperty: PayPeriodUnit
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Not:
Fn::Equals:
- ${PayType}
- PostPaid
Default: Month
AllowedValues:
- Month
- Year
PayPeriod:
Type: Number
Label:
en: Period
zh-cn: Period
AssociationProperty: PayPeriod
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Not:
Fn::Equals:
- ${PayType}
- PostPaid
Default: 1
AllowedValues:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
VpcId:
Type: String
Label:
en: VPC ID
zh-cn: VPC ID
AssociationProperty: ALIYUN::ECS::VPC::VPCId
ZoneId:
Type: String
Label:
en: Zone ID
zh-cn: Zone ID
AssociationProperty: ALIYUN::ECS::Instance:ZoneId
VSwitchId:
Type: String
Label:
en: VSwitch ID
zh-cn: VSwitch ID
AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
AssociationPropertyMetadata:
VpcId: ${VpcId}
ZoneId: ${ZoneId}
SecurityGroupId:
Type: String
Label:
en: Business Security Group ID
zh-cn: Business Security Group ID
AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId
AssociationPropertyMetadata:
VpcId: ${VpcId}
NumOfNodes:
Type: Number
Label:
zh-cn: Number of worker nodes
en: Number of Worker instances
Default: 3
PodCidr:
Type: String
Label:
zh-cn: Pod Network CIDR
en: Pod Network CIDR
Description:
zh-cn: Enter a valid private CIDR block. Examples include 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, and their subnets.<br/>The CIDR block cannot overlap with the CIDR block of the VPC or the CIDR blocks of existing Kubernetes clusters in the VPC. <font color='blue'><b>This setting cannot be changed after the cluster is created.</font>
en: 'Enter a valid private CIDR block. Examples include 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, and their subnets.<br/>The CIDR block cannot overlap with the CIDR block of the VPC or the CIDR blocks of existing Kubernetes clusters in the VPC. <font color=''blue''><b>This setting cannot be changed after the cluster is created.</font>'
AssociationProperty: ALIYUN::CS::ManagedKubernetesCluster::PodCidr
Default: 172.20.0.0/16
ServiceCidr:
Type: String
Label:
zh-cn: Service CIDR
en: Service CIDR
Description:
zh-cn: Enter a valid CIDR block with a prefix length from 16 to 24. The CIDR block must be within one of the following private network ranges: 10.0.0.0/8, 172.16.0.0/12, or 192.168.0.0/16.<br/>The CIDR block cannot overlap with the CIDR block of the VPC or the CIDR blocks of existing Kubernetes clusters in the VPC. <font color='blue'><b>This setting cannot be changed after the cluster is created.</font>
en: 'Enter a valid CIDR block with a prefix length from 16 to 24. The CIDR block must be within one of the following private network ranges: 10.0.0.0/8, 172.16.0.0/12, or 192.168.0.0/16.<br/>The CIDR block cannot overlap with the CIDR block of the VPC or the CIDR blocks of existing Kubernetes clusters in the VPC. <font color=''blue''><b>This setting cannot be changed after the cluster is created.</font>'
AssociationProperty: ALIYUN::CS::ManagedKubernetesCluster::ServiceCidr
Default: 172.21.0.0/20
SnatEntry:
Type: Boolean
Label:
zh-cn: Configure SNAT
en: Configure SNAT
Description:
zh-cn: Configure SNAT for the virtual private cloud (VPC).<br/>If resources in your cluster, such as nodes and applications, need to access the public network, select this option. A NAT Gateway is created and SNAT rules are configured for you automatically. <b><a href='https://www.alibabacloud.com/help/en/doc-detail/48126.html' target='_blank'><font color='blue'>NAT Gateway pricing</font></a>
en: Configure SNAT for the virtual private cloud (VPC).<br/>If resources in your cluster, such as nodes and applications, need to access the public network, select this option. A NAT Gateway is created and SNAT rules are configured for you automatically. <b><a href='https://www.alibabacloud.com/help/en/doc-detail/48126.html' target='_blank'><font color='blue'>NAT Gateway pricing</font></a>
Default: true
EndpointPublicAccess:
Type: Boolean
Label:
en: Public Access
zh-cn: Public Access
Description:
en: Expose the API server using an elastic IP address (EIP).<br/>By default, an internal-facing Server Load Balancer (SLB) instance is created for the API server. If you delete this instance, the API server becomes inaccessible.<br><font color='blue'><b>If you do not enable public access, you cannot access the cluster API server from the public network.</font>
zh-cn: Expose the API server using an elastic IP address (EIP).<br/>By default, an internal-facing Server Load Balancer (SLB) instance is created for the API server. If you delete this instance, the API server becomes inaccessible.<br><font color='blue'><b>If you do not enable public access, you cannot access the cluster API server from the public network.</font>
Default: false
CloudMonitorFlag:
Type: Boolean
Label:
zh-cn: Monitoring plugin
en: Monitor Plug-in
Description:
zh-cn: Install the CloudMonitor agent on the ECS nodes.
en: Install the CloudMonitor agent on the ECS nodes.
Default: true
WorkerInstanceTypes:
Type: CommaDelimitedList
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
AssociationPropertyMetadata:
InstanceChargeType: ${PayPeriod}
ZoneId: ${ZoneId}
Label:
en: Instance Type
zh-cn: Instance Type
WorkerSystemDiskSize:
Type: Number
Label:
zh-cn: Worker node system disk size
en: Worker System Disk Space
Description:
zh-cn: The size of the system disk, in GB. Valid values: 40 to 500.
en: 'The size of the system disk, in GB. Valid values: 40 to 500.'
Default: 40
MinValue: 40
MaxValue: 500
WorkerSystemDiskCategory:
Type: String
Label:
en: Worker System Disk Category
zh-cn: Worker node system disk category
AssociationPropertyMetadata:
LocaleKey: DiskCategory
Default: cloud_essd
AllowedValues:
- cloud_efficiency
- cloud_ssd
- cloud_essd
LoginPassword:
Type: String
NoEcho: true
Label:
en: Instance Password
zh-cn: Instance Password
Description:
en: The password must be 8 to 30 characters in length and contain characters from at least three of the following categories: uppercase letters, lowercase letters, digits, and special characters. The supported special characters are ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/
zh-cn: The password must be 8 to 30 characters in length and contain characters from at least three of the following categories: uppercase letters, lowercase letters, digits, and special characters. The supported special characters are ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/
ConstraintDescription:
en: The password must be 8 to 30 characters in length and contain characters from at least three of the following categories: uppercase letters, lowercase letters, digits, and special characters. The supported special characters are ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/
zh-cn: The password must be 8 to 30 characters in length and contain characters from at least three of the following categories: uppercase letters, lowercase letters, digits, and special characters. The supported special characters are ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/
AssociationProperty: ALIYUN::ECS::Instance::Password
Resources:
NodePools:
Type: ALIYUN::CS::ClusterNodePool
Properties:
ClusterId:
Ref: ManagedKubernetesCluster
NodePoolInfo:
Name: default-nodepool
ScalingGroup:
Period:
Ref: PayPeriod
PeriodUnit:
Ref: PayPeriodUnit
InstanceChargeType:
Ref: PayType
VSwitchIds:
- Ref: VSwitchId
ZoneIds:
- Ref: ZoneId
SystemDiskCategory:
Ref: WorkerSystemDiskCategory
SystemDiskSize:
Ref: WorkerSystemDiskSize
InstanceTypes:
Ref: WorkerInstanceTypes
LoginPassword:
Ref: LoginPassword
Platform: AliyunLinux
ImageId: aliyun_3_9_x64_20G_alibase_20231219.vhd
KubernetesConfig:
Runtime: containerd
RuntimeVersion: 1.6.28
Count:
Ref: NumOfNodes
ManagedKubernetesCluster:
Type: ALIYUN::CS::ManagedKubernetesCluster
Properties:
VpcId:
Ref: VpcId
VSwitchIds:
- Ref: VSwitchId
SecurityGroupId:
Ref: SecurityGroupId
ZoneIds:
- Ref: ZoneId
ClusterSpec: ack.pro.small
ContainerCidr:
Ref: PodCidr
ServiceCidr:
Ref: ServiceCidr
LoginPassword:
Ref: LoginPassword
SnatEntry:
Ref: SnatEntry
Addons:
- Name: flannel
Config: ''
CloudMonitorFlags:
Ref: CloudMonitorFlag
ProxyMode: IPVS
EndpointPublicAccess:
Ref: EndpointPublicAccess
Name:
Ref: ALIYUN::StackName
Outputs:
ClusterId:
Value:
Fn::GetAtt:
- ManagedKubernetesCluster
- ClusterId
TaskId:
Value:
Fn::GetAtt:
- ManagedKubernetesCluster
- TaskId
WorkerRamRoleName:
Value:
Fn::GetAtt:
- ManagedKubernetesCluster
- WorkerRamRoleName
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- PayType
- PayPeriodUnit
- PayPeriod
Label:
default:
en: PayType Configuration
zh-cn: PayType Configuration
- Parameters:
- VpcId
- ZoneId
- VSwitchId
- SecurityGroupId
Label:
default:
zh-cn: Infrastructure Configuration (Required)
en: Infrastructure Configuration (Required)
- Parameters:
- NumOfNodes
- PodCidr
- ServiceCidr
- SnatEntry
- EndpointPublicAccess
- CloudMonitorFlag
- WorkerInstanceTypes
- WorkerSystemDiskSize
- WorkerSystemDiskCategory
- LoginPassword
Label:
default:
zh-cn: Kubernetes Basic Configuration (Required)
en: Kubernetes Basic Configuration (Required)
TemplateTags:
- acs:example:ISV Software Deployment:Create ACK Dedicated Cluster (Existing VPC)
{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
"zh-cn": "Configure billing methods on the existing VPC, vSwitches, and security groups. Then, create a Kubernetes cluster that includes worker nodes, network settings, and monitoring plugins.",
"en": "Configure billing methods on the existing VPC, switches, and security groups, then proceed to create a Kubernetes cluster inclusive of worker nodes, network configurations, and monitoring plugins."
},
"Parameters": {
"PayType": {
"Type": "String",
"Label": {
"en": "ECS Instance Charge Type",
"zh-cn": "ECS Instance Charge Type"
},
"AssociationProperty": "ChargeType",
"AssociationPropertyMetadata": {
"LocaleKey": "InstanceChargeType"
},
"Default": "PostPaid",
"AllowedValues": [
"PostPaid",
"PrePaid"
]
},
"PayPeriodUnit": {
"Type": "String",
"Label": {
"en": "Pay Period Unit",
"zh-cn": "Pay Period Unit"
},
"AssociationProperty": "PayPeriodUnit",
"AssociationPropertyMetadata": {
"Visible": {
"Condition": {
"Fn::Not": {
"Fn::Equals": [
"${PayType}",
"PostPaid"
]
}
}
}
},
"Default": "Month",
"AllowedValues": [
"Month",
"Year"
]
},
"PayPeriod": {
"Type": "Number",
"Label": {
"en": "Period",
"zh-cn": "Period"
},
"AssociationProperty": "PayPeriod",
"AssociationPropertyMetadata": {
"Visible": {
"Condition": {
"Fn::Not": {
"Fn::Equals": [
"${PayType}",
"PostPaid"
]
}
}
}
},
"Default": 1,
"AllowedValues": [
1,
2,
3,
4,
5,
6,
7,
8,
9
]
},
"VpcId": {
"Type": "String",
"Label": {
"en": "VPC ID",
"zh-cn": "VPC ID"
},
"AssociationProperty": "ALIYUN::ECS::VPC::VPCId"
},
"ZoneId": {
"Type": "String",
"Label": {
"en": "Zone ID",
"zh-cn": "Zone ID"
},
"AssociationProperty": "ALIYUN::ECS::Instance:ZoneId"
},
"VSwitchId": {
"Type": "String",
"Label": {
"en": "VSwitch ID",
"zh-cn": "VSwitch ID"
},
"AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
"AssociationPropertyMetadata": {
"VpcId": "${VpcId}",
"ZoneId": "${ZoneId}"
}
},
"SecurityGroupId": {
"Type": "String",
"Label": {
"en": "Business Security Group ID",
"zh-cn": "Business Security Group ID"
},
"AssociationProperty": "ALIYUN::ECS::SecurityGroup::SecurityGroupId",
"AssociationPropertyMetadata": {
"VpcId": "${VpcId}"
}
},
"NumOfNodes": {
"Type": "Number",
"Label": {
"zh-cn": "Number of worker nodes",
"en": "Number of Worker instances"
},
"Default": 3
},
"PodCidr": {
"Type": "String",
"Label": {
"zh-cn": "Pod Network CIDR",
"en": "Pod Network CIDR"
},
"Description": {
"zh-cn": "Enter a valid private CIDR block. Examples include 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, and their subnets.<br/>The CIDR block cannot overlap with the CIDR block of the VPC or the CIDR blocks of existing Kubernetes clusters in the VPC. <font color='blue'><b>This setting cannot be changed after the cluster is created.</font>",
"en": "Enter a valid private CIDR block. Examples include 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, and their subnets.<br/>The CIDR block cannot overlap with the CIDR block of the VPC or the CIDR blocks of existing Kubernetes clusters in the VPC. <font color='blue'><b>This setting cannot be changed after the cluster is created.</font>"
},
"AssociationProperty": "ALIYUN::CS::ManagedKubernetesCluster::PodCidr",
"Default": "172.20.0.0/16"
},
"ServiceCidr": {
"Type": "String",
"Label": {
"zh-cn": "Service CIDR",
"en": "Service CIDR"
},
"Description": {
"zh-cn": "Enter a valid CIDR block with a prefix length from 16 to 24. The CIDR block must be within one of the following private network ranges: 10.0.0.0/8, 172.16.0.0/12, or 192.168.0.0/16.<br/>The CIDR block cannot overlap with the CIDR block of the VPC or the CIDR blocks of existing Kubernetes clusters in the VPC. <font color='blue'><b>This setting cannot be changed after the cluster is created.</font>",
"en": "Enter a valid CIDR block with a prefix length from 16 to 24. The CIDR block must be within one of the following private network ranges: 10.0.0.0/8, 172.16.0.0/12, or 192.168.0.0/16.<br/>The CIDR block cannot overlap with the CIDR block of the VPC or the CIDR blocks of existing Kubernetes clusters in the VPC. <font color='blue'><b>This setting cannot be changed after the cluster is created.</font>"
},
"AssociationProperty": "ALIYUN::CS::ManagedKubernetesCluster::ServiceCidr",
"Default": "172.21.0.0/20"
},
"SnatEntry": {
"Type": "Boolean",
"Label": {
"zh-cn": "Configure SNAT",
"en": "Configure SNAT"
},
"Description": {
"zh-cn": "Configure SNAT for the virtual private cloud (VPC).<br/>If resources in your cluster, such as nodes and applications, need to access the public network, select this option. A NAT Gateway is created and SNAT rules are configured for you automatically. <b><a href='https://www.alibabacloud.com/help/en/doc-detail/48126.html' target='_blank'><font color='blue'>NAT Gateway pricing</font></a>",
"en": "Configure SNAT for the virtual private cloud (VPC).<br/>If resources in your cluster, such as nodes and applications, need to access the public network, select this option. A NAT Gateway is created and SNAT rules are configured for you automatically. <b><a href='https://www.alibabacloud.com/help/en/doc-detail/48126.html' target='_blank'><font color='blue'>NAT Gateway pricing</font></a>"
},
"Default": true
},
"EndpointPublicAccess": {
"Type": "Boolean",
"Label": {
"en": "Public Access",
"zh-cn": "Public Access"
},
"Description": {
"en": "Expose the API server using an elastic IP address (EIP).<br/>By default, an internal-facing Server Load Balancer (SLB) instance is created for the API server. If you delete this instance, the API server becomes inaccessible.<br><font color='blue'><b>If you do not enable public access, you cannot access the cluster API server from the public network.</font>",
"zh-cn": "Expose the API server using an elastic IP address (EIP).<br/>By default, an internal-facing Server Load Balancer (SLB) instance is created for the API server. If you delete this instance, the API server becomes inaccessible.<br><font color='blue'><b>If you do not enable public access, you cannot access the cluster API server from the public network.</font>"
},
"Default": false
},
"CloudMonitorFlag": {
"Type": "Boolean",
"Label": {
"zh-cn": "Monitoring plugin",
"en": "Monitor Plug-in"
},
"Description": {
"zh-cn": "Install the CloudMonitor agent on the ECS nodes.",
"en": "Install the CloudMonitor agent on the ECS nodes."
},
"Default": true
},
"WorkerInstanceTypes": {
"Type": "CommaDelimitedList",
"AssociationProperty": "ALIYUN::ECS::Instance::InstanceType",
"AssociationPropertyMetadata": {
"InstanceChargeType": "${PayPeriod}",
"ZoneId": "${ZoneId}"
},
"Label": {
"en": "Instance Type",
"zh-cn": "Instance Type"
}
},
"WorkerSystemDiskSize": {
"Type": "Number",
"Label": {
"zh-cn": "Worker node system disk size",
"en": "Worker System Disk Space"
},
"Description": {
"zh-cn": "The size of the system disk, in GB. Valid values: 40 to 500.",
"en": "The size of the system disk, in GB. Valid values: 40 to 500."
},
"Default": 40,
"MinValue": 40,
"MaxValue": 500
},
"WorkerSystemDiskCategory": {
"Type": "String",
"Label": {
"en": "Worker System Disk Category",
"zh-cn": "Worker node system disk category"
},
"AssociationPropertyMetadata": {
"LocaleKey": "DiskCategory"
},
"Default": "cloud_essd",
"AllowedValues": [
"cloud_efficiency",
"cloud_ssd",
"cloud_essd"
]
},
"LoginPassword": {
"Type": "String",
"NoEcho": true,
"Label": {
"en": "Instance Password",
"zh-cn": "Instance Password"
},
"Description": {
"en": "The password must be 8 to 30 characters in length and contain characters from at least three of the following categories: uppercase letters, lowercase letters, digits, and special characters. The supported special characters are ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/",
"zh-cn": "The password must be 8 to 30 characters in length and contain characters from at least three of the following categories: uppercase letters, lowercase letters, digits, and special characters. The supported special characters are ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/"
},
"ConstraintDescription": {
"en": "The password must be 8 to 30 characters in length and contain characters from at least three of the following categories: uppercase letters, lowercase letters, digits, and special characters. The supported special characters are ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/",
"zh-cn": "The password must be 8 to 30 characters in length and contain characters from at least three of the following categories: uppercase letters, lowercase letters, digits, and special characters. The supported special characters are ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/"
},
"AssociationProperty": "ALIYUN::ECS::Instance::Password"
}
},
"Resources": {
"NodePools": {
"Type": "ALIYUN::CS::ClusterNodePool",
"Properties": {
"ClusterId": {
"Ref": "ManagedKubernetesCluster"
},
"NodePoolInfo": {
"Name": "default-nodepool"
},
"ScalingGroup": {
"Period": {
"Ref": "PayPeriod"
},
"PeriodUnit": {
"Ref": "PayPeriodUnit"
},
"InstanceChargeType": {
"Ref": "PayType"
},
"VSwitchIds": [
{
"Ref": "VSwitchId"
}
],
"ZoneIds": [
{
"Ref": "ZoneId"
}
],
"SystemDiskCategory": {
"Ref": "WorkerSystemDiskCategory"
},
"SystemDiskSize": {
"Ref": "WorkerSystemDiskSize"
},
"InstanceTypes": {
"Ref": "WorkerInstanceTypes"
},
"LoginPassword": {
"Ref": "LoginPassword"
},
"Platform": "AliyunLinux",
"ImageId": "aliyun_3_9_x64_20G_alibase_20231219.vhd"
},
"KubernetesConfig": {
"Runtime": "containerd",
"RuntimeVersion": "1.6.28"
},
"Count": {
"Ref": "NumOfNodes"
}
}
},
"ManagedKubernetesCluster": {
"Type": "ALIYUN::CS::ManagedKubernetesCluster",
"Properties": {
"VpcId": {
"Ref": "VpcId"
},
"VSwitchIds": [
{
"Ref": "VSwitchId"
}
],
"SecurityGroupId": {
"Ref": "SecurityGroupId"
},
"ZoneIds": [
{
"Ref": "ZoneId"
}
],
"ClusterSpec": "ack.pro.small",
"ContainerCidr": {
"Ref": "PodCidr"
},
"ServiceCidr": {
"Ref": "ServiceCidr"
},
"LoginPassword": {
"Ref": "LoginPassword"
},
"SnatEntry": {
"Ref": "SnatEntry"
},
"Addons": [
{
"Name": "flannel",
"Config": ""
}
],
"CloudMonitorFlags": {
"Ref": "CloudMonitorFlag"
},
"ProxyMode": "IPVS",
"EndpointPublicAccess": {
"Ref": "EndpointPublicAccess"
},
"Name": {
"Ref": "ALIYUN::StackName"
}
}
}
},
"Outputs": {
"ClusterId": {
"Value": {
"Fn::GetAtt": [
"ManagedKubernetesCluster",
"ClusterId"
]
}
},
"TaskId": {
"Value": {
"Fn::GetAtt": [
"ManagedKubernetesCluster",
"TaskId"
]
}
},
"WorkerRamRoleName": {
"Value": {
"Fn::GetAtt": [
"ManagedKubernetesCluster",
"WorkerRamRoleName"
]
}
}
},
"Metadata": {
"ALIYUN::ROS::Interface": {
"ParameterGroups": [
{
"Parameters": [
"PayType",
"PayPeriodUnit",
"PayPeriod"
],
"Label": {
"default": {
"en": "PayType Configuration",
"zh-cn": "PayType Configuration"
}
}
},
{
"Parameters": [
"VpcId",
"ZoneId",
"VSwitchId",
"SecurityGroupId"
],
"Label": {
"default": {
"zh-cn": "Infrastructure Configuration (Required)",
"en": "Infrastructure Configuration (Required)"
}
}
},
{
"Parameters": [
"NumOfNodes",
"PodCidr",
"ServiceCidr",
"SnatEntry",
"EndpointPublicAccess",
"CloudMonitorFlag",
"WorkerInstanceTypes",
"WorkerSystemDiskSize",
"WorkerSystemDiskCategory",
"LoginPassword"
],
"Label": {
"default": {
"zh-cn": "Kubernetes Basic Configuration (Required)",
"en": "Kubernetes Basic Configuration (Required)"
}
}
}
],
"TemplateTags": [
"acs:example:ISV Software Deployment:Create ACK Dedicated Cluster (Existing VPC)"
]
}
}
}Cenário 3: Criar microsserviços com o ACK.
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: Create an ACK cluster, configure a VPC and security groups, deploy microservice applications, automatically scale node pools, set up ALB Ingress, and output the service access URL.
en: Create an ACK cluster, configure a VPC and security groups, deploy microservice applications, automatically scale node pools, set up ALB Ingress, and output the service access URL.
Parameters:
CommonName:
Type: String
Default: microservices-on-ack
ManagedKubernetesClusterName:
Type: String
Label:
en: Managed Kubernetes Cluster Name
zh-cn: Managed Kubernetes Cluster Name
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: Availability Zone 1
ZoneId2:
Type: String
AssociationProperty: 'ALIYUN::ECS::Instance::ZoneId'
AssociationPropertyMetadata:
ExclusiveTo:
- ZoneId1
Label:
en: Availability Zone
zh-cn: Availability 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 logon password. Length must be 8–30 characters and include three of the following: uppercase letters, lowercase letters, numbers, or special symbols ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/
zh-cn: >-
Server logon password. Length must be 8–30 characters and include three of the following: uppercase letters, lowercase letters, numbers, or special symbols ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/
Label:
en: Instance Password
zh-cn: Instance Password
ConstraintDescription:
en: >-
Length must be 8–30 characters and include three of the following: uppercase letters, lowercase letters, numbers, or special symbols ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/
zh-cn: 'Length must be 8–30 characters and include three of the following: uppercase letters, lowercase letters, numbers, or special symbols ()`~!@#$%^&*_-+=|{}[]:;''<>,.?/'
AssociationProperty: 'ALIYUN::ECS::Instance::Password'
Default: null
Resources:
Vpc:
Type: 'ALIYUN::ECS::VPC'
Properties:
CidrBlock: 10.0.0.0/8
VpcName:
Fn::Sub: ${CommonName}-vpc
VSwitch1:
Type: 'ALIYUN::ECS::VSwitch'
Properties:
VpcId:
Ref: Vpc
CidrBlock: 10.0.0.0/24
ZoneId:
Ref: ZoneId1
VSwitchName:
Fn::Sub: ${CommonName}-vsw
VSwitch2:
Type: 'ALIYUN::ECS::VSwitch'
Properties:
VpcId:
Ref: Vpc
CidrBlock: 10.0.1.0/24
ZoneId:
Ref: ZoneId2
VSwitchName:
Fn::Sub: ${CommonName}-vsw
SecurityGroup:
Type: 'ALIYUN::ECS::SecurityGroup'
Properties:
VpcId:
Ref: Vpc
SecurityGroupName:
Fn::Sub: ${CommonName}-sg
SecurityGroupIngress:
- PortRange: 8080/8080
SourceCidrIp: 0.0.0.0/0
IpProtocol: tcp
- PortRange: 80/80
SourceCidrIp: 0.0.0.0/0
IpProtocol: tcp
AckCluster:
Type: 'ALIYUN::CS::ManagedKubernetesCluster'
Properties:
VpcId:
Ref: Vpc
VSwitchIds:
- Ref: VSwitch1
- Ref: VSwitch2
PodVswitchIds:
- Ref: VSwitch1
- Ref: VSwitch1
Name:
Ref: ManagedKubernetesClusterName
KubernetesVersion: 1.33.1-aliyun.1
ServiceCidr: 192.168.0.0/16
ClusterSpec: ack.pro.small
LoadBalancerSpec: slb.s2.small
IsEnterpriseSecurityGroup: true
SnatEntry: true
NumOfNodes: 0
EndpointPublicAccess: true
Platform: AliyunLinux
Addons:
- Name: terway-eniip
Config: '{"IPVlan":"false","NetworkPolicy":"false","ENITrunking":"false"}'
- Name: csi-plugin
- Name: csi-provisioner
- Name: storage-operator
Config: '{"CnfsOssEnable":"false","CnfsNasEnable":"false"}'
- Name: logtail-ds
Config: '{"IngressDashboardEnabled":"true"}'
- Name: nginx-ingress-controller
Disabled: true
- Name: alb-ingress-controller
Version: ""
Config:
Fn::Sub: >-
{"albIngress":{"AddressType":"Internet","ZoneMappings":{"${ZoneId1}":["${VSwitch1}"],
"${ZoneId2}":["${VSwitch2}"]},"CreateDefaultALBConfig":true}}
- Name: ack-node-local-dns
ProxyMode: ipvs
DeleteOptions:
- ResourceType: ALB
DeleteMode: delete
- ResourceType: SLB
DeleteMode: delete
- ResourceType: SLS_Data
DeleteMode: delete
- ResourceType: SLS_ControlPlane
DeleteMode: delete
- ResourceType: PrivateZone
DeleteMode: delete
NodePools:
Type: 'ALIYUN::CS::ClusterNodePool'
Properties:
ClusterId:
Ref: AckCluster
NodePoolInfo:
Name: default-nodepool
ScalingGroup:
InstanceChargeType: PostPaid
VSwitchIds:
- Ref: VSwitch1
- Ref: VSwitch2
ZoneIds:
- Ref: ZoneId1
- Ref: ZoneId2
SystemDiskCategory: cloud_essd
SystemDiskPerformanceLevel: PL0
SystemDiskSize: 120
InstanceTypes:
Ref: InstanceType
LoginPassword:
Ref: InstancePassword
Platform: AliyunLinux
ImageId: aliyun_3_9_x64_20G_alibase_20231219.vhd
KubernetesConfig:
Runtime: containerd
RuntimeVersion: 1.6.28
Count: 3
InstallBackendApp:
Type: 'ALIYUN::CS::ClusterApplication'
DependsOn: NodePools
Properties:
ClusterId:
Ref: AckCluster
YamlContent:
Fn::Sub: |-
apiVersion: apps/v1 # for versions before 1.8.0 use apps/v1beta1
kind: Deployment
metadata:
name: ecs-ack-test-service-a
labels:
app: ecs-ack-test-service-a
spec:
replicas: 2
selector:
matchLabels:
app: ecs-ack-test-service-a
template:
metadata:
labels:
app: ecs-ack-test-service-a
spec:
initContainers:
- name: download-jar
image: dragonwell-registry.cn-hangzhou.cr.aliyuncs.com/dragonwell/dragonwell:8-alinux
command:
- "/bin/sh"
- "-c"
- "curl -o /app/app.jar https://help-static-aliyun-doc.aliyuncs.com/tech-solution/MicroServiceOnAckDemo-1.0.1.jar && echo 'Download jar OK!'"
volumeMounts:
- name: app-jar
mountPath: /app
containers:
- args:
- '-DbHost=http://ecs-ack-test-service-b:8080'
- '-jar'
- '/app/app.jar'
command:
- java
name: ecs-ack-test-service-a
image: dragonwell-registry.cn-hangzhou.cr.aliyuncs.com/dragonwell/dragonwell:8-alinux
env:
- name: APP_MANUAL_DEPLOY
value: "false"
ports:
- containerPort: 8080
resources:
limits:
cpu: '2'
ephemeral-storage: 40Gi
memory: 2Gi
requests:
cpu: '1'
ephemeral-storage: 20Gi
memory: 1Gi
volumeMounts:
- name: app-jar
mountPath: /app
volumes:
- name: app-jar
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: ecs-ack-test-service-a
spec:
selector:
app: ecs-ack-test-service-a
ports:
- protocol: TCP
port: 8080
targetPort: 8080
---
apiVersion: apps/v1 # for versions before 1.8.0 use apps/v1beta1
kind: Deployment
metadata:
name: ecs-ack-test-service-b
labels:
app: ecs-ack-test-service-b
spec:
replicas: 2
selector:
matchLabels:
app: ecs-ack-test-service-b
template:
metadata:
labels:
app: ecs-ack-test-service-b
spec:
initContainers:
- name: download-jar
image: dragonwell-registry.cn-hangzhou.cr.aliyuncs.com/dragonwell/dragonwell:8-alinux
command:
- "/bin/sh"
- "-c"
- "curl -o /app/app.jar https://help-static-aliyun-doc.aliyuncs.com/tech-solution/MicroServiceOnAckDemo-1.0.1.jar && echo 'Download jar OK!'"
volumeMounts:
- name: app-jar
mountPath: /app
containers:
- args:
- '-DbHost=http://ecs-ack-test-service-b:8080'
- '-jar'
- '/app/app.jar'
command:
- java
name: ecs-ack-test-service-b
image: dragonwell-registry.cn-hangzhou.cr.aliyuncs.com/dragonwell/dragonwell:8-alinux
env:
- name: APP_MANUAL_DEPLOY
value: "false"
ports:
- containerPort: 8080
resources:
limits:
cpu: '2'
ephemeral-storage: 40Gi
memory: 2Gi
requests:
cpu: '1'
ephemeral-storage: 20Gi
memory: 1Gi
volumeMounts:
- name: app-jar
mountPath: /app
volumes:
- name: app-jar
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: ecs-ack-test-service-b
spec:
selector:
app: ecs-ack-test-service-b
ports:
- protocol: TCP
port: 8080
targetPort: 8080
AlbConfig:
Type: 'ALIYUN::CS::ClusterApplication'
DependsOn: InstallBackendApp
Properties:
ClusterId:
Ref: AckCluster
YamlContent:
Fn::Sub: |-
apiVersion: alibabacloud.com/v1
kind: AlbConfig
metadata:
name: ecs-ack-test-alb-config
spec:
config:
name: ecs-ack-test-alb
addressType: Internet
zoneMappings:
- vSwitchId: ${VSwitch1}
- vSwitchId: ${VSwitch2}
listeners:
- port: 80
protocol: HTTP
---
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
name: ecs-ack-test-alb
spec:
controller: ingress.k8s.alibabacloud/alb
parameters:
apiGroup: alibabacloud.com
kind: AlbConfig
name: ecs-ack-test-alb-config
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ecs-ack-test-alb-ingress
spec:
ingressClassName: ecs-ack-test-alb
rules:
- http:
paths:
- path: /a
pathType: ImplementationSpecific
backend:
service:
name: ecs-ack-test-service-a
port:
number: 8080
- path: /b
pathType: ImplementationSpecific
backend:
service:
name: ecs-ack-test-service-b
port:
number: 8080
WaitAlbIngress:
Type: ALIYUN::ROS::Sleep
DependsOn: AlbConfig
Properties:
CreateDuration: 120
IngressInfo:
Type: 'DATASOURCE::CS::ClusterApplicationResources'
DependsOn: WaitAlbIngress
Properties:
ClusterId:
Ref: AckCluster
Kind: Ingress
Namespace: default
JsonPath: $.items.[0].status.loadBalancer.ingress.[0].hostname
FirstMatch: true
Outputs:
UrlServiceA:
Description:
zh-cn: The endpoint for service A.
en: The endpoint for service A.
Value:
'Fn::Sub': http://${IngressInfo}/a
UrlServiceB:
Description:
zh-cn: The endpoint for service B.
en: The endpoint for service B.
Value:
'Fn::Sub': http://${IngressInfo}/b
Metadata:
'ALIYUN::ROS::Interface':
ParameterGroups:
- Parameters:
- SlsProjectName
- ManagedKubernetesClusterName
- ZoneId1
- ZoneId2
- InstanceType
- InstancePassword
TemplateTags:
- acs:technical-solution:micro:how-to-quickly-build-microservices-using-ack-tech_solu_124
Hidden:
- CommonName{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
"zh-cn": "Create an ACK cluster, configure a VPC and security groups, deploy microservice applications, automatically scale node pools, set up ALB Ingress, and output the service access URL.",
"en": "Create an ACK cluster, configure a VPC and security groups, deploy microservice applications, automatically scale node pools, set up ALB Ingress, and output the service access URL."
},
"Parameters": {
"CommonName": {
"Type": "String",
"Default": "microservices-on-ack"
},
"ManagedKubernetesClusterName": {
"Type": "String",
"Label": {
"en": "Managed Kubernetes Cluster Name",
"zh-cn": "Managed Kubernetes Cluster Name"
},
"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": "Availability Zone 1"
}
},
"ZoneId2": {
"Type": "String",
"AssociationProperty": "ALIYUN::ECS::Instance::ZoneId",
"AssociationPropertyMetadata": {
"ExclusiveTo": [
"ZoneId1"
]
},
"Label": {
"en": "Availability Zone",
"zh-cn": "Availability 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 logon password. Length must be 8–30 characters and include three of the following: uppercase letters, lowercase letters, numbers, or special symbols ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/",
"zh-cn": "Server logon password. Length must be 8–30 characters and include three of the following: uppercase letters, lowercase letters, numbers, or special symbols ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/"
},
"Label": {
"en": "Instance Password",
"zh-cn": "Instance Password"
},
"ConstraintDescription": {
"en": "Length must be 8–30 characters and include three of the following: uppercase letters, lowercase letters, numbers, or special symbols ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/",
"zh-cn": "Length must be 8–30 characters and include three of the following: uppercase letters, lowercase letters, numbers, or special symbols ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/"
},
"AssociationProperty": "ALIYUN::ECS::Instance::Password",
"Default": null
}
},
"Resources": {
"Vpc": {
"Type": "ALIYUN::ECS::VPC",
"Properties": {
"CidrBlock": "10.0.0.0/8",
"VpcName": {
"Fn::Sub": "${CommonName}-vpc"
}
}
},
"VSwitch1": {
"Type": "ALIYUN::ECS::VSwitch",
"Properties": {
"VpcId": {
"Ref": "Vpc"
},
"CidrBlock": "10.0.0.0/24",
"ZoneId": {
"Ref": "ZoneId1"
},
"VSwitchName": {
"Fn::Sub": "${CommonName}-vsw"
}
}
},
"VSwitch2": {
"Type": "ALIYUN::ECS::VSwitch",
"Properties": {
"VpcId": {
"Ref": "Vpc"
},
"CidrBlock": "10.0.1.0/24",
"ZoneId": {
"Ref": "ZoneId2"
},
"VSwitchName": {
"Fn::Sub": "${CommonName}-vsw"
}
}
},
"SecurityGroup": {
"Type": "ALIYUN::ECS::SecurityGroup",
"Properties": {
"VpcId": {
"Ref": "Vpc"
},
"SecurityGroupName": {
"Fn::Sub": "${CommonName}-sg"
},
"SecurityGroupIngress": [
{
"PortRange": "8080/8080",
"SourceCidrIp": "0.0.0.0/0",
"IpProtocol": "tcp"
},
{
"PortRange": "80/80",
"SourceCidrIp": "0.0.0.0/0",
"IpProtocol": "tcp"
}
]
}
},
"AckCluster": {
"Type": "ALIYUN::CS::ManagedKubernetesCluster",
"Properties": {
"VpcId": {
"Ref": "Vpc"
},
"VSwitchIds": [
{
"Ref": "VSwitch1"
},
{
"Ref": "VSwitch2"
}
],
"PodVswitchIds": [
{
"Ref": "VSwitch1"
},
{
"Ref": "VSwitch1"
}
],
"Name": {
"Ref": "ManagedKubernetesClusterName"
},
"KubernetesVersion": "1.33.1-aliyun.1",
"ServiceCidr": "192.168.0.0/16",
"ClusterSpec": "ack.pro.small",
"LoadBalancerSpec": "slb.s2.small",
"IsEnterpriseSecurityGroup": true,
"SnatEntry": true,
"NumOfNodes": 0,
"EndpointPublicAccess": true,
"Platform": "AliyunLinux",
"Addons": [
{
"Name": "terway-eniip",
"Config": "{\"IPVlan\":\"false\",\"NetworkPolicy\":\"false\",\"ENITrunking\":\"false\"}"
},
{
"Name": "csi-plugin"
},
{
"Name": "csi-provisioner"
},
{
"Name": "storage-operator",
"Config": "{\"CnfsOssEnable\":\"false\",\"CnfsNasEnable\":\"false\"}"
},
{
"Name": "logtail-ds",
"Config": "{\"IngressDashboardEnabled\":\"true\"}"
},
{
"Name": "nginx-ingress-controller",
"Disabled": true
},
{
"Name": "alb-ingress-controller",
"Version": "",
"Config": {
"Fn::Sub": "{\"albIngress\":{\"AddressType\":\"Internet\",\"ZoneMappings\":{\"${ZoneId1}\":[\"${VSwitch1}\"], \"${ZoneId2}\":[\"${VSwitch2}\"]},\"CreateDefaultALBConfig\":true}}"
}
},
{
"Name": "ack-node-local-dns"
}
],
"ProxyMode": "ipvs",
"DeleteOptions": [
{
"ResourceType": "ALB",
"DeleteMode": "delete"
},
{
"ResourceType": "SLB",
"DeleteMode": "delete"
},
{
"ResourceType": "SLS_Data",
"DeleteMode": "delete"
},
{
"ResourceType": "SLS_ControlPlane",
"DeleteMode": "delete"
},
{
"ResourceType": "PrivateZone",
"DeleteMode": "delete"
}
]
}
},
"NodePools": {
"Type": "ALIYUN::CS::ClusterNodePool",
"Properties": {
"ClusterId": {
"Ref": "AckCluster"
},
"NodePoolInfo": {
"Name": "default-nodepool"
},
"ScalingGroup": {
"InstanceChargeType": "PostPaid",
"VSwitchIds": [
{
"Ref": "VSwitch1"
},
{
"Ref": "VSwitch2"
}
],
"ZoneIds": [
{
"Ref": "ZoneId1"
},
{
"Ref": "ZoneId2"
}
],
"SystemDiskCategory": "cloud_essd",
"SystemDiskPerformanceLevel": "PL0",
"SystemDiskSize": 120,
"InstanceTypes": {
"Ref": "InstanceType"
},
"LoginPassword": {
"Ref": "InstancePassword"
},
"Platform": "AliyunLinux",
"ImageId": "aliyun_3_9_x64_20G_alibase_20231219.vhd"
},
"KubernetesConfig": {
"Runtime": "containerd",
"RuntimeVersion": "1.6.28"
},
"Count": 3
}
},
"InstallBackendApp": {
"Type": "ALIYUN::CS::ClusterApplication",
"DependsOn": "NodePools",
"Properties": {
"ClusterId": {
"Ref": "AckCluster"
},
"YamlContent": {
"Fn::Sub": "apiVersion: apps/v1 # for versions before 1.8.0 use apps/v1beta1\nkind: Deployment\nmetadata:\n name: ecs-ack-test-service-a\n labels:\n app: ecs-ack-test-service-a\nspec:\n replicas: 2\n selector:\n matchLabels:\n app: ecs-ack-test-service-a\n template:\n metadata:\n labels:\n app: ecs-ack-test-service-a\n spec:\n initContainers:\n - name: download-jar\n image: dragonwell-registry.cn-hangzhou.cr.aliyuncs.com/dragonwell/dragonwell:8-alinux\n command:\n - \"/bin/sh\"\n - \"-c\"\n - \"curl -o /app/app.jar https://help-static-aliyun-doc.aliyuncs.com/tech-solution/MicroServiceOnAckDemo-1.0.1.jar && echo 'Download jar OK!'\"\n volumeMounts:\n - name: app-jar\n mountPath: /app\n containers:\n - args:\n - '-DbHost=http://ecs-ack-test-service-b:8080'\n - '-jar'\n - '/app/app.jar'\n command:\n - java\n name: ecs-ack-test-service-a\n image: dragonwell-registry.cn-hangzhou.cr.aliyuncs.com/dragonwell/dragonwell:8-alinux\n env:\n - name: APP_MANUAL_DEPLOY\n value: \"false\"\n ports:\n - containerPort: 8080\n resources:\n limits:\n cpu: '2'\n ephemeral-storage: 40Gi\n memory: 2Gi\n requests:\n cpu: '1'\n ephemeral-storage: 20Gi\n memory: 1Gi\n volumeMounts:\n - name: app-jar\n mountPath: /app\n volumes:\n - name: app-jar\n emptyDir: {}\n---\napiVersion: v1\nkind: Service\nmetadata:\n name: ecs-ack-test-service-a\nspec:\n selector:\n app: ecs-ack-test-service-a\n ports:\n - protocol: TCP\n port: 8080\n targetPort: 8080\n---\napiVersion: apps/v1 # for versions before 1.8.0 use apps/v1beta1\nkind: Deployment\nmetadata:\n name: ecs-ack-test-service-b\n labels:\n app: ecs-ack-test-service-b\nspec:\n replicas: 2\n selector:\n matchLabels:\n app: ecs-ack-test-service-b\n template:\n metadata:\n labels:\n app: ecs-ack-test-service-b\n spec:\n initContainers:\n - name: download-jar\n image: dragonwell-registry.cn-hangzhou.cr.aliyuncs.com/dragonwell/dragonwell:8-alinux\n command:\n - \"/bin/sh\"\n - \"-c\"\n - \"curl -o /app/app.jar https://help-static-aliyun-doc.aliyuncs.com/tech-solution/MicroServiceOnAckDemo-1.0.1.jar && echo 'Download jar OK!'\"\n volumeMounts:\n - name: app-jar\n mountPath: /app\n containers:\n - args:\n - '-DbHost=http://ecs-ack-test-service-b:8080'\n - '-jar'\n - '/app/app.jar'\n command:\n - java\n name: ecs-ack-test-service-b\n image: dragonwell-registry.cn-hangzhou.cr.aliyuncs.com/dragonwell/dragonwell:8-alinux\n env:\n - name: APP_MANUAL_DEPLOY\n value: \"false\"\n ports:\n - containerPort: 8080\n resources:\n limits:\n cpu: '2'\n ephemeral-storage: 40Gi\n memory: 2Gi\n requests:\n cpu: '1'\n ephemeral-storage: 20Gi\n memory: 1Gi\n volumeMounts:\n - name: app-jar\n mountPath: /app\n volumes:\n - name: app-jar\n emptyDir: {}\n---\napiVersion: v1\nkind: Service\nmetadata:\n name: ecs-ack-test-service-b\nspec:\n selector:\n app: ecs-ack-test-service-b\n ports:\n - protocol: TCP\n port: 8080\n targetPort: 8080"
}
}
},
"AlbConfig": {
"Type": "ALIYUN::CS::ClusterApplication",
"DependsOn": "InstallBackendApp",
"Properties": {
"ClusterId": {
"Ref": "AckCluster"
},
"YamlContent": {
"Fn::Sub": "apiVersion: alibabacloud.com/v1\nkind: AlbConfig\nmetadata:\n name: ecs-ack-test-alb-config\nspec:\n config:\n name: ecs-ack-test-alb\n addressType: Internet\n zoneMappings:\n - vSwitchId: ${VSwitch1}\n - vSwitchId: ${VSwitch2}\n listeners:\n - port: 80\n protocol: HTTP\n---\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n name: ecs-ack-test-alb\nspec:\n controller: ingress.k8s.alibabacloud/alb\n parameters:\n apiGroup: alibabacloud.com\n kind: AlbConfig\n name: ecs-ack-test-alb-config\n---\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n name: ecs-ack-test-alb-ingress\nspec:\n ingressClassName: ecs-ack-test-alb \n rules:\n - http:\n paths:\n - path: /a\n pathType: ImplementationSpecific\n backend:\n service:\n name: ecs-ack-test-service-a\n port:\n number: 8080\n - path: /b\n pathType: ImplementationSpecific\n backend:\n service:\n name: ecs-ack-test-service-b\n port: \n number: 8080"
}
}
},
"WaitAlbIngress": {
"Type": "ALIYUN::ROS::Sleep",
"DependsOn": "AlbConfig",
"Properties": {
"CreateDuration": 120
}
},
"IngressInfo": {
"Type": "DATASOURCE::CS::ClusterApplicationResources",
"DependsOn": "WaitAlbIngress",
"Properties": {
"ClusterId": {
"Ref": "AckCluster"
},
"Kind": "Ingress",
"Namespace": "default",
"JsonPath": "$.items.[0].status.loadBalancer.ingress.[0].hostname",
"FirstMatch": true
}
}
},
"Outputs": {
"UrlServiceA": {
"Description": {
"zh-cn": "The endpoint for service A.",
"en": "The endpoint for service A."
},
"Value": {
"Fn::Sub": "http://${IngressInfo}/a"
}
},
"UrlServiceB": {
"Description": {
"zh-cn": "The endpoint for service B.",
"en": "The endpoint for service B."
},
"Value": {
"Fn::Sub": "http://${IngressInfo}/b"
}
}
},
"Metadata": {
"ALIYUN::ROS::Interface": {
"ParameterGroups": [
{
"Parameters": [
"SlsProjectName",
"ManagedKubernetesClusterName",
"ZoneId1",
"ZoneId2",
"InstanceType",
"InstancePassword"
]
}
],
"TemplateTags": [
"acs:technical-solution:micro:how-to-quickly-build-microservices-using-ack-tech_solu_124"
],
"Hidden": [
"CommonName"
]
}
}
}Para mais exemplos, consulte modelos públicos que contêm este recurso.