ALIYUN::CS::ClusterAddons类型用于指定集群安装组件。
语法
{
"Type": "ALIYUN::CS::ClusterAddons",
"Properties": {
"ClusterId": String,
"Addons": List,
"InstalledIgnore": Boolean,
"WaitUntil": List,
"OverrideExisting": Boolean,
"RolePolicy": String,
"ValidationMode": String
}
}
属性
|
属性名称 |
类型 |
必须 |
允许更新 |
描述 |
约束 |
|
Addons |
List |
是 |
是 |
组件配置信息列表。 |
更多信息,请参见Addons属性。 |
|
ClusterId |
String |
是 |
否 |
集群ID。 |
无 |
|
InstalledIgnore |
Boolean |
否 |
否 |
创建集群时是否忽略已安装的组件。 |
取值:
|
|
OverrideExisting |
Boolean |
否 |
否 |
创建时是否覆盖已安装插件(addon)的配置。 |
如果为 true,创建时,已存在的插件将覆盖其配置,不存在的插件将被安装;删除时,仅卸载在创建阶段安装的插件。 不能与 InstalledIgnore 同时使用。 默认值为 false。 |
|
RolePolicy |
String |
否 |
是 |
在部署应用程序之前,请检查与当前用户的角色关联的策略。 |
取值:
|
|
ValidationMode |
String |
否 |
否 |
验证模式。 |
取值:
|
|
WaitUntil |
List |
否 |
是 |
开始创建或更新后,等待直到满足所有条件。 |
更多信息,请参见WaitUntil属性。 |
Addons语法
"Addons": [
{
"Version": String,
"Config": String,
"Name": String
}
]
Addons属性
|
属性名称 |
类型 |
必须 |
允许更新 |
描述 |
约束 |
|
Name |
String |
是 |
否 |
组件名称。 |
无 |
|
Config |
String |
否 |
是 |
组件配置信息。 |
无 |
|
Version |
String |
否 |
否 |
组件版本。 |
无 |
WaitUntil语法
"WaitUntil": [
{
"ApiVersion": String,
"FirstMatch": Boolean,
"Timeout": Integer,
"JsonPath": String,
"Namespace": String,
"Stage": String,
"Name": String,
"ValueType": String,
"Kind": String,
"Value": String,
"Operator": String
}
]
WaitUntil属性
|
属性名称 |
类型 |
必须 |
允许更新 |
描述 |
约束 |
|
Kind |
String |
是 |
是 |
要查询的kubernetes资源类型。 |
无 |
|
Name |
String |
是 |
是 |
要查询的kubernetes资源名称。 |
无 |
|
Operator |
String |
是 |
是 |
将值与JsonPath表达式的结果进行比较的操作符。 |
无 |
|
ApiVersion |
String |
否 |
是 |
API版本。 |
无 |
|
FirstMatch |
Boolean |
否 |
是 |
只返回 JsonPath过滤结果中的第一个匹配结果。 |
取值:
|
|
JsonPath |
String |
否 |
是 |
Json路径表达式用于过滤输出。 |
无 |
|
Namespace |
String |
否 |
是 |
资源所在的kubernetes的命名空间。 |
默认值为DefaultNamespace。 |
|
Stage |
String |
否 |
否 |
在什么阶段等待。 |
取值:
|
|
Timeout |
Integer |
否 |
是 |
等待满足条件的超时时间。 |
单位为秒。 |
|
Value |
String |
否 |
是 |
要与JsonPath表达式的结果进行比较的值。 |
无 |
|
ValueType |
String |
否 |
是 |
值的类型。 |
默认值为String。 |
返回值
Fn::GetAtt
-
ClusterId:集群ID。
-
WaitUntilData:WaitUntil中每个JsonPath的值列表。
示例
场景 1 :为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"
]
}
}
}
}场景 2 :为ACK集群安装Ingress和监控组件,并指定版本和自定义配置。
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"
]
}
}
}
}场景 3 :为ACK集群安装完整的生产级组件套件,使用WaitUntil等待组件就绪后再继续部署。
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"
]
}
}
}
}