Todos os produtos
Search
Central de documentação

Resource Orchestration Service:ALIYUN::CS::ClusterAddons

Última atualização: Jul 24, 2026

O tipo ALIYUN::CS::ClusterAddons instala addons em um cluster específico.

Sintaxe

{
  "Type": "ALIYUN::CS::ClusterAddons",
  "Properties": {
    "ClusterId": String,
    "Addons": List,
    "InstalledIgnore": Boolean,
    "WaitUntil": List,
    "OverrideExisting": Boolean,
    "RolePolicy": String,
    "ValidationMode": String
  }
}

Propriedades

Propriedade

Tipo

Obrigatória

Editável

Descrição

Restrições

Addons

List

Sim

Sim

Lista de configurações dos addons.

Para mais informações, consulte Addons properties.

ClusterId

String

Sim

Não

ID do cluster.

Nenhuma

InstalledIgnore

Boolean

Não

Não

Indica se os addons já instalados devem ser ignorados na criação do cluster.

Valores válidos:

  • true: ignora addons já instalados. Na criação do cluster, instale apenas os addons pendentes. Na exclusão, desinstala somente os addons instalados durante a criação.

  • false (padrão): não ignora addons já instalados.

OverrideExisting

Boolean

Não

Não

Indica se a configuração dos addons já instalados deve ser substituída durante a criação.

Se true, substitui as configurações dos addons existentes durante a criação e instale os addons ausentes. Na exclusão, desinstala apenas os addons instalados na criação. Incompatível com InstalledIgnore. Valor padrão: false.

RolePolicy

String

Não

Sim

Verifica as políticas associadas à função do usuário atual antes de implantar a aplicação.

Valores válidos:

  • EnsureAdminRoleAndBinding (padrão): crie automaticamente a função ros:application-admin:${user-id} com permissões de administrador e a vincula ao usuário atual.

  • None: nenhuma ação executada.

ValidationMode

String

Não

Não

Modo de validação.

Valores válidos:

  • Basic: validação básica, como verificar a existência do cluster.

  • Strict: além da validação básica, valida a integridade de WaitUntil.

WaitUntil

List

Não

Sim

Após iniciar a criação ou atualização, aguarda o atendimento de todas as condições.

Para mais informações, consulte WaitUntil properties.

Sintaxe de Addons

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

Propriedades de Addons

Propriedade

Tipo

Obrigatória

Editável

Descrição

Restrições

Name

String

Sim

Não

Nome do addon.

Nenhuma

Config

String

Não

Sim

Configuração do addon.

Nenhuma

Version

String

Não

Não

Versão do addon.

Nenhuma

Sintaxe de WaitUntil

"WaitUntil": [
  {
   "ApiVersion": String,
   "FirstMatch": Boolean,
   "Timeout": Integer,
   "JsonPath": String,
   "Namespace": String,
   "Stage": String,
   "Name": String,
   "ValueType": String,
   "Kind": String,
   "Value": String,
   "Operator": String
  }
]

Propriedades de WaitUntil

Propriedade

Tipo

Obrigatória

Editável

Descrição

Restrições

Kind

String

Sim

Sim

Tipo de recurso do Kubernetes a consultar.

Nenhuma

Name

String

Sim

Sim

Nome do recurso do Kubernetes a consultar.

Nenhuma

Operator

String

Sim

Sim

Operador para comparar o valor com o resultado da expressão JsonPath.

Nenhuma

ApiVersion

String

Não

Sim

Versão da API.

Nenhuma

FirstMatch

Boolean

Não

Sim

Retorna apenas a primeira correspondência do filtro JsonPath.

Valores válidos:

  • true

  • false (padrão)

JsonPath

String

Não

Sim

Expressão de caminho JSON para filtrar a saída.

Nenhuma

Namespace

String

Não

Sim

Namespace do Kubernetes onde o recurso reside.

Valor padrão: DefaultNamespace.

Stage

String

Não

Não

Estágio de espera.

Valores válidos:

  • Create/Update (padrão): estágios de criação e atualização.

  • Delete: estágio de exclusão.

Timeout

Integer

Não

Sim

Tempo limite para aguardar o atendimento das condições.

Unidade: segundos.

Value

String

Não

Sim

Valor para comparação com o resultado da expressão JsonPath.

Nenhuma

ValueType

String

Não

Sim

Tipo do valor.

Valor padrão: String.

Valores de retorno

Fn::GetAtt

  • ClusterId: ID do cluster.

  • WaitUntilData: lista de valores para cada JsonPath em WaitUntil.

Exemplos

Cenário 1: Instalar addons básicos de rede e log para um cluster ACK

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 为ACK集群安装基础网络和日志组件。
  en: Install basic network and logging addons for an ACK cluster.
Parameters:
  ClusterId:
    Type: String
    Label:
      zh-cn: 集群ID
      en: Cluster ID
    Description:
      zh-cn: ACK集群的唯一标识,可在容器服务控制台获取。
      en: The unique identifier of the ACK cluster, available in the Container Service console.
    AssociationProperty: ALIYUN::CS::Cluster::ClusterId
Resources:
  ClusterAddons:
    Type: ALIYUN::CS::ClusterAddons
    Properties:
      ClusterId:
        Ref: ClusterId
      Addons:
        - Name: flannel
        - Name: logtail-ds
      InstalledIgnore: true
Outputs:
  ClusterId:
    Label:
      zh-cn: 集群ID
      en: Cluster ID
    Description:
      zh-cn: 已安装组件的ACK集群ID。
      en: The ACK cluster ID with addons installed.
    Value:
      Fn::GetAtt:
        - ClusterAddons
        - ClusterId
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "为ACK集群安装基础网络和日志组件。",
    "en": "Install basic network and logging addons for an ACK cluster."
  },
  "Parameters": {
    "ClusterId": {
      "Type": "String",
      "Label": {
        "zh-cn": "集群ID",
        "en": "Cluster ID"
      },
      "Description": {
        "zh-cn": "ACK集群的唯一标识,可在容器服务控制台获取。",
        "en": "The unique identifier of the ACK cluster, available in the Container Service console."
      },
      "AssociationProperty": "ALIYUN::CS::Cluster::ClusterId"
    }
  },
  "Resources": {
    "ClusterAddons": {
      "Type": "ALIYUN::CS::ClusterAddons",
      "Properties": {
        "ClusterId": {
          "Ref": "ClusterId"
        },
        "Addons": [
          {
            "Name": "flannel"
          },
          {
            "Name": "logtail-ds"
          }
        ],
        "InstalledIgnore": true
      }
    }
  },
  "Outputs": {
    "ClusterId": {
      "Label": {
        "zh-cn": "集群ID",
        "en": "Cluster ID"
      },
      "Description": {
        "zh-cn": "已安装组件的ACK集群ID。",
        "en": "The ACK cluster ID with addons installed."
      },
      "Value": {
        "Fn::GetAtt": [
          "ClusterAddons",
          "ClusterId"
        ]
      }
    }
  }
}

Cenário 2: Instalar addons de Ingress e monitoramento para um cluster ACK com fixação de versão e configuração personalizada

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 为ACK集群安装Ingress和监控组件,指定版本和自定义配置。
  en: Install Ingress and monitoring addons with version pinning and custom config.
Parameters:
  ClusterId:
    Type: String
    Label:
      zh-cn: 集群ID
      en: Cluster ID
    Description:
      zh-cn: 目标ACK集群的唯一标识。
      en: The unique identifier of the target ACK cluster.
    AssociationProperty: ALIYUN::CS::Cluster::ClusterId
  IngressVersion:
    Type: String
    Label:
      zh-cn: Ingress组件版本
      en: Ingress Addon Version
    Description:
      zh-cn: >-
        Nginx Ingress Controller的版本号。
        留空则安装最新版本。
      en: >-
        Version of Nginx Ingress Controller.
        Leave empty to install the latest version.
    Default: ''
  IngressReplicas:
    Type: Number
    Label:
      zh-cn: Ingress副本数
      en: Ingress Replicas
    Description:
      zh-cn: Nginx Ingress Controller的副本数量,生产环境建议至少2个副本。
      en: Number of Nginx Ingress Controller replicas. At least 2 replicas recommended for production.
    Default: 2
    MinValue: 1
    MaxValue: 10
  RolePolicy:
    Type: String
    Label:
      zh-cn: 角色策略
      en: Role Policy
    Description:
      zh-cn: >-
        部署组件前的角色检查策略。
        EnsureAdminRoleAndBinding:自动创建管理员角色并绑定。
        None:不执行角色操作。
      en: >-
        Role check policy before deploying addons.
        EnsureAdminRoleAndBinding: auto-create admin role and bindingit.
        None: skip role operations.
    Default: EnsureAdminRoleAndBinding
    AllowedValues:
      - EnsureAdminRoleAndBinding
      - None
Resources:
  ClusterAddons:
    Type: ALIYUN::CS::ClusterAddons
    Properties:
      ClusterId:
        Ref: ClusterId
      InstalledIgnore: true
      RolePolicy:
        Ref: RolePolicy
      Addons:
        - Name: nginx-ingress-controller
          Version:
            Ref: IngressVersion
          Config:
            Fn::Sub:
              - '{"IngressSlbNetworkType":"internet","IngressSlbSpec":"slb.s2.small","IngressReplicaCount":${Replicas}}'
              - Replicas:
                  Ref: IngressReplicas
        - Name: arms-prometheus
Outputs:
  ClusterId:
    Label:
      zh-cn: 集群ID
      en: Cluster ID
    Value:
      Fn::GetAtt:
        - ClusterAddons
        - ClusterId
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "为ACK集群安装Ingress和监控组件,指定版本和自定义配置。",
    "en": "Install Ingress and monitoring addons with version pinning and custom config."
  },
  "Parameters": {
    "ClusterId": {
      "Type": "String",
      "Label": {
        "zh-cn": "集群ID",
        "en": "Cluster ID"
      },
      "Description": {
        "zh-cn": "目标ACK集群的唯一标识。",
        "en": "The unique identifier of the target ACK cluster."
      },
      "AssociationProperty": "ALIYUN::CS::Cluster::ClusterId"
    },
    "IngressVersion": {
      "Type": "String",
      "Label": {
        "zh-cn": "Ingress组件版本",
        "en": "Ingress Addon Version"
      },
      "Description": {
        "zh-cn": "Nginx Ingress Controller的版本号。留空则安装最新版本。",
        "en": "Version of Nginx Ingress Controller. Leave empty to install the latest version."
      },
      "Default": ""
    },
    "IngressReplicas": {
      "Type": "Number",
      "Label": {
        "zh-cn": "Ingress副本数",
        "en": "Ingress Replicas"
      },
      "Description": {
        "zh-cn": "Nginx Ingress Controller的副本数量,生产环境建议至少2个副本。",
        "en": "Number of Nginx Ingress Controller replicas. At least 2 replicas recommended for production."
      },
      "Default": 2,
      "MinValue": 1,
      "MaxValue": 10
    },
    "RolePolicy": {
      "Type": "String",
      "Label": {
        "zh-cn": "角色策略",
        "en": "Role Policy"
      },
      "Description": {
        "zh-cn": "部署组件前的角色检查策略。EnsureAdminRoleAndBinding:自动创建管理员角色并绑定。None:不执行角色操作。",
        "en": "Role check policy before deploying addons. EnsureAdminRoleAndBinding: auto-create admin role and bind it. None: skip role operations."
      },
      "Default": "EnsureAdminRoleAndBinding",
      "AllowedValues": [
        "EnsureAdminRoleAndBinding",
        "None"
      ]
    }
  },
  "Resources": {
    "ClusterAddons": {
      "Type": "ALIYUN::CS::ClusterAddons",
      "Properties": {
        "ClusterId": {
          "Ref": "ClusterId"
        },
        "InstalledIgnore": true,
        "RolePolicy": {
          "Ref": "RolePolicy"
        },
        "Addons": [
          {
            "Name": "nginx-ingress-controller",
            "Version": {
              "Ref": "IngressVersion"
            },
            "Config": {
              "Fn::Sub": [
                "{\"IngressSlbNetworkType\":\"internet\",\"IngressSlbSpec\":\"slb.s2.small\",\"IngressReplicaCount\":${Replicas}}",
                {
                  "Replicas": {
                    "Ref": "IngressReplicas"
                  }
                }
              ]
            }
          },
          {
            "Name": "arms-prometheus"
          }
        ]
      }
    }
  },
  "Outputs": {
    "ClusterId": {
      "Label": {
        "zh-cn": "集群ID",
        "en": "Cluster ID"
      },
      "Value": {
        "Fn::GetAtt": [
          "ClusterAddons",
          "ClusterId"
        ]
      }
    }
  }
}

Cenário 3: Instalar um conjunto completo de addons de produção para um cluster ACK e usar WaitUntil para aguardar a prontidão antes de continuar a implantação

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 为ACK集群安装完整的生产级组件套件,使用WaitUntil等待组件就绪。
  en: Install a full production addon suite for ACK with WaitUntil readiness checks.
Parameters:
  ClusterId:
    Type: String
    Label:
      zh-cn: 集群ID
      en: Cluster ID
    Description:
      zh-cn: 目标ACK集群的唯一标识。
      en: The unique identifier of the target ACK cluster.
    AssociationProperty: ALIYUN::CS::Cluster::ClusterId
  IngressReplicas:
    Type: Number
    Label:
      zh-cn: Ingress副本数
      en: Ingress Replicas
    Description:
      zh-cn: Nginx Ingress Controller的副本数量。
      en: Number of Nginx Ingress Controller replicas.
    Default: 2
    MinValue: 1
    MaxValue: 10
  WaitTimeout:
    Type: Number
    Label:
      zh-cn: 组件就绪超时时间(秒)
      en: Addon Readiness Timeout (seconds)
    Description:
      zh-cn: >-
        等待组件就绪的超时时间,单位为秒。
        超时后资源栈将回滚。建议根据集群规模适当调大。
      en: >-
        Timeout for waiting addon readiness, in seconds.
        Stack will roll back on timeout. Increase for larger clusters.
    Default: 300
    MinValue: 60
    MaxValue: 1800
Resources:
  ClusterAddons:
    Type: ALIYUN::CS::ClusterAddons
    Properties:
      ClusterId:
        Ref: ClusterId
      InstalledIgnore: true
      RolePolicy: EnsureAdminRoleAndBinding
      ValidationMode: Strict
      Addons:
        - Name: terway-eniip
        - Name: coredns
        - Name: nginx-ingress-controller
          Config:
            Fn::Sub:
              - '{"IngressSlbNetworkType":"internet","IngressSlbSpec":"slb.s2.small","IngressReplicaCount":${Replicas}}'
              - Replicas:
                  Ref: IngressReplicas
        - Name: arms-prometheus
      WaitUntil:
        - Kind: Deployment
          Name: coredns
          Namespace: kube-system
          JsonPath: $.status.readyReplicas
          Value: '1'
          Operator: NotEmpty
          Timeout:
            Ref: WaitTimeout
          Stage: Create/Update
          ApiVersion: apps/v1
          FirstMatch: true
        - Kind: DaemonSet
          Name: terway-eniip
          Namespace: kube-system
          JsonPath: $.status.numberReady
          Value: '1'
          Operator: NotEmpty
          Timeout:
            Ref: WaitTimeout
          Stage: Create/Update
          ApiVersion: apps/v1
          FirstMatch: true
Outputs:
  ClusterId:
    Label:
      zh-cn: 集群ID
      en: Cluster ID
    Description:
      zh-cn: 已完成生产级组件部署的ACK集群ID。
      en: The ACK cluster ID with production addons deployed.
    Value:
      Fn::GetAtt:
        - ClusterAddons
        - ClusterId
  WaitUntilData:
    Label:
      zh-cn: 组件就绪检查结果
      en: Addon Readiness Check Results
    Description:
      zh-cn: WaitUntil中每个JsonPath的值列表,用于验证组件是否已就绪。
      en: The value list for each JsonPath in WaitUntil, for verifying addon readiness.
    Value:
      Fn::GetAtt:
        - ClusterAddons
        - WaitUntilData
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "为ACK集群安装完整的生产级组件套件,使用WaitUntil等待组件就绪。",
    "en": "Install a full production addon suite for ACK with WaitUntil readiness checks."
  },
  "Parameters": {
    "ClusterId": {
      "Type": "String",
      "Label": {
        "zh-cn": "集群ID",
        "en": "Cluster ID"
      },
      "Description": {
        "zh-cn": "目标ACK集群的唯一标识。",
        "en": "The unique identifier of the target ACK cluster."
      },
      "AssociationProperty": "ALIYUN::CS::Cluster::ClusterId"
    },
    "IngressReplicas": {
      "Type": "Number",
      "Label": {
        "zh-cn": "Ingress副本数",
        "en": "Ingress Replicas"
      },
      "Description": {
        "zh-cn": "Nginx Ingress Controller的副本数量。",
        "en": "Number of Nginx Ingress Controller replicas."
      },
      "Default": 2,
      "MinValue": 1,
      "MaxValue": 10
    },
    "WaitTimeout": {
      "Type": "Number",
      "Label": {
        "zh-cn": "组件就绪超时时间(秒)",
        "en": "Addon Readiness Timeout (seconds)"
      },
      "Description": {
        "zh-cn": "等待组件就绪的超时时间,单位为秒。超时后资源栈将回滚。建议根据集群规模适当调大。",
        "en": "Timeout for waiting addon readiness, in seconds. Stack will roll back on timeout. Increase for larger clusters."
      },
      "Default": 300,
      "MinValue": 60,
      "MaxValue": 1800
    }
  },
  "Resources": {
    "ClusterAddons": {
      "Type": "ALIYUN::CS::ClusterAddons",
      "Properties": {
        "ClusterId": {
          "Ref": "ClusterId"
        },
        "InstalledIgnore": true,
        "RolePolicy": "EnsureAdminRoleAndBinding",
        "ValidationMode": "Strict",
        "Addons": [
          {
            "Name": "terway-eniip"
          },
          {
            "Name": "coredns"
          },
          {
            "Name": "nginx-ingress-controller",
            "Config": {
              "Fn::Sub": [
                "{\"IngressSlbNetworkType\":\"internet\",\"IngressSlbSpec\":\"slb.s2.small\",\"IngressReplicaCount\":${Replicas}}",
                {
                  "Replicas": {
                    "Ref": "IngressReplicas"
                  }
                }
              ]
            }
          },
          {
            "Name": "arms-prometheus"
          }
        ],
        "WaitUntil": [
          {
            "Kind": "Deployment",
            "Name": "coredns",
            "Namespace": "kube-system",
            "JsonPath": "$.status.readyReplicas",
            "Value": "1",
            "Operator": "NotEmpty",
            "Timeout": {
              "Ref": "WaitTimeout"
            },
            "Stage": "Create/Update",
            "ApiVersion": "apps/v1",
            "FirstMatch": true
          },
          {
            "Kind": "DaemonSet",
            "Name": "terway-eniip",
            "Namespace": "kube-system",
            "JsonPath": "$.status.numberReady",
            "Value": "1",
            "Operator": "NotEmpty",
            "Timeout": {
              "Ref": "WaitTimeout"
            },
            "Stage": "Create/Update",
            "ApiVersion": "apps/v1",
            "FirstMatch": true
          }
        ]
      }
    }
  },
  "Outputs": {
    "ClusterId": {
      "Label": {
        "zh-cn": "集群ID",
        "en": "Cluster ID"
      },
      "Description": {
        "zh-cn": "已完成生产级组件部署的ACK集群ID。",
        "en": "The ACK cluster ID with production addons deployed."
      },
      "Value": {
        "Fn::GetAtt": [
          "ClusterAddons",
          "ClusterId"
        ]
      }
    },
    "WaitUntilData": {
      "Label": {
        "zh-cn": "组件就绪检查结果",
        "en": "Addon Readiness Check Results"
      },
      "Description": {
        "zh-cn": "WaitUntil中每个JsonPath的值列表,用于验证组件是否已就绪。",
        "en": "The value list for each JsonPath in WaitUntil, for verifying addon readiness."
      },
      "Value": {
        "Fn::GetAtt": [
          "ClusterAddons",
          "WaitUntilData"
        ]
      }
    }
  }
}