全部产品
Search
文档中心

资源编排:ALIYUN::CS::AnyCluster

更新时间:May 27, 2024

ALIYUN::CS::AnyCluster类型用于创建任意类型的Kubernetes集群实例。

语法

{
  "Type": "ALIYUN::CS::AnyCluster",
  "Properties": {
    "ClusterConfig": Map
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

ClusterConfig

Map

集群配置。

更多信息,请参见创建Kubernetes集群的API。例如:创建一个Kubernetes托管版集群实例,请参见通过OpenAPI创建Kubernetes托管版集群

返回值

Fn::GetAtt

  • ClusterId:集群ID。

  • TaskId:任务ID。系统自动分配,用于查询任务状态。

  • WorkerRamRoleName:Worker节点RAM角色名称。

  • DefaultUserKubeConfig:用户默认的Kubernetes配置,用于配置集群凭据。

  • ScalingRuleId:伸缩规则ID。

  • ScalingGroupId:伸缩组ID。

  • PrivateUserKubConfig:用户专有的Kubernetes配置,用于配置集群凭据。

  • ScalingConfigurationId:伸缩配置ID。

  • Nodes:集群节点列表。

  • APIServerSLBId:API Server的负载均衡ID。

  • IngressSLBId:Ingress负载均衡ID。

示例

YAML格式

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  VpcId:
    Type: String
    AssociationProperty: ALIYUN::ECS::VPC::VPCId
    Label:
      en: VPC
      zh-cn: 私有网络
  VSwitchIds:
    Type: CommaDelimitedList
    AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
    AssociationPropertyMetadata:
      VpcId: VpcId
    Label:
      en: VSwitchIds
      zh-cn: 交换机ID列表
  KeyPairName:
    Type: String
    Label:
      en: Key Pair Name
      zh-cn: 密钥对名称
    AssociationProperty: ALIYUN::ECS::KeyPair::KeyPairName
    Description:
      en: Please enter the name of the existing key pair. If you use the instance password Login, the key pair name does not need to be filled in
      zh-cn: 请输入已有密钥对的名称。如使用实例密码登录,密钥对名称不需要填写。
Resources:
  AnyCluster:
    Type: ALIYUN::CS::AnyCluster
    Properties:
      ClusterConfig:
        name: cluster-demo
        cluster_type: ManagedKubernetes
        disable_rollback: true
        timeout_mins: 60
        kubernetes_version: 1.22.3-aliyun.1
        region_id:
          Ref: ALIYUN::Region
        snat_entry: true
        cloud_monitor_flags: true
        endpoint_public_access: false
        deletion_protection: true
        node_cidr_mask: '26'
        proxy_mode: ipvs
        tags: []
        timezone: Asia/Shanghai
        addons:
          - name: flannel
          - name: csi-plugin
          - name: csi-provisioner
          - name: storage-operator
            config: '{"CnfsOssEnable":"false","CnfsNasEnable":"true"}'
          - name: logtail-ds
            config: '{"IngressDashboardEnabled":"true"}'
          - name: ack-node-problem-detector
            config: '{"sls_project_name":""}'
          - name: nginx-ingress-controller
            config: '{"IngressSlbNetworkType":"internet","IngressSlbSpec":"slb.s2.small"}'
          - name: ack-node-local-dns
          - name: arms-prometheus
          - name: alicloud-monitor-controller
            config: '{"group_contact_ids":"[2066]"}'
        cluster_spec: ack.pro.small
        load_balancer_spec: slb.s2.small
        os_type: Linux
        platform: AliyunLinux
        image_type: AliyunLinux
        runtime:
          name: containerd
          version: 1.4.8
        charge_type: PostPaid
        vpcid:
          Ref: VpcId
        container_cidr: 10.9.0.0/16
        service_cidr: 172.16.0.0/16
        vswitch_ids:
          Ref: VSwitchIds
        key_pair:
          Ref: KeyPairName
        logging_type: SLS
        cpu_policy: none
        is_enterprise_security_group: true
        controlplane_log_ttl: '30'
        controlplane_log_components:
          - apiserver
          - kcm
          - scheduler
          - ccm
        nodepools:
          - nodepool_info:
              name: default-nodepool
            scaling_group:
              vswitch_ids:
                Ref: VSwitchIds
              system_disk_category: cloud_efficiency
              system_disk_size: 120
              system_disk_performance_level: ''
              data_disks: []
              instance_types:
                - ecs.i2ne.xlarge
              tags: []
              instance_charge_type: PostPaid
              soc_enabled: false
              key_pair:
                Ref: KeyPairName
              is_enterprise_security_group: true
              platform: AliyunLinux
              image_id: aliyun_2_1903_x64_20G_alibase_20210726.vhd
              image_type: AliyunLinux
              rds_instances: []
            kubernetes_config:
              cpu_policy: none
              labels: []
              runtime: containerd
              runtime_version: 1.4.8
            count: 3
        num_of_nodes: 0
Outputs:
  TaskId:
    Description: Task ID. Automatically assigned by the system, the user queries the task status.
    Value:
      Fn::GetAtt:
        - AnyCluster
        - TaskId
  ClusterId:
    Description: Cluster instance ID.
    Value:
      Fn::GetAtt:
        - AnyCluster
        - ClusterId
  ScalingGroupId:
    Description: Scaling group id
    Value:
      Fn::GetAtt:
        - AnyCluster
        - ScalingGroupId
  ScalingRuleId:
    Description: Scaling rule id
    Value:
      Fn::GetAtt:
        - AnyCluster
        - ScalingRuleId
  DefaultUserKubeConfig:
    Description: Default user kubernetes config which is used for configuring cluster credentials.
    Value:
      Fn::GetAtt:
        - AnyCluster
        - DefaultUserKubeConfig
  WorkerRamRoleName:
    Description: Worker ram role name.
    Value:
      Fn::GetAtt:
        - AnyCluster
        - WorkerRamRoleName
  ScalingConfigurationId:
    Description: Scaling configuration id
    Value:
      Fn::GetAtt:
        - AnyCluster
        - ScalingConfigurationId
  PrivateUserKubConfig:
    Description: Private user kubernetes config which is used for configuring cluster credentials.
    Value:
      Fn::GetAtt:
        - AnyCluster
        - PrivateUserKubConfig
  Nodes:
    Description: The list of cluster nodes.
    Value:
      Fn::GetAtt:
        - AnyCluster
        - Nodes

JSON格式

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "VpcId": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::VPC::VPCId",
      "Label": {
        "en": "VPC",
        "zh-cn": "私有网络"
      }
    },
    "VSwitchIds": {
      "Type": "CommaDelimitedList",
      "AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
      "AssociationPropertyMetadata": {
        "VpcId": "VpcId"
      },
      "Label": {
        "en": "VSwitchIds",
        "zh-cn": "交换机ID列表"
      }
    },
    "KeyPairName": {
      "Type": "String",
      "Label": {
        "en": "Key Pair Name",
        "zh-cn": "密钥对名称"
      },
      "AssociationProperty": "ALIYUN::ECS::KeyPair::KeyPairName",
      "Description": {
        "en": "Please enter the name of the existing key pair. If you use the instance password Login, the key pair name does not need to be filled in",
        "zh-cn": "请输入已有密钥对的名称。如使用实例密码登录,密钥对名称不需要填写。"
      }
    }
  },
  "Resources": {
    "AnyCluster": {
      "Type": "ALIYUN::CS::AnyCluster",
      "Properties": {
        "ClusterConfig": {
          "name": "cluster-demo",
          "cluster_type": "ManagedKubernetes",
          "disable_rollback": true,
          "timeout_mins": 60,
          "kubernetes_version": "1.22.3-aliyun.1",
          "region_id": {
            "Ref": "ALIYUN::Region"
          },
          "snat_entry": true,
          "cloud_monitor_flags": true,
          "endpoint_public_access": false,
          "deletion_protection": true,
          "node_cidr_mask": "26",
          "proxy_mode": "ipvs",
          "tags": [],
          "timezone": "Asia/Shanghai",
          "addons": [
            {
              "name": "flannel"
            },
            {
              "name": "csi-plugin"
            },
            {
              "name": "csi-provisioner"
            },
            {
              "name": "storage-operator",
              "config": "{\"CnfsOssEnable\":\"false\",\"CnfsNasEnable\":\"true\"}"
            },
            {
              "name": "logtail-ds",
              "config": "{\"IngressDashboardEnabled\":\"true\"}"
            },
            {
              "name": "ack-node-problem-detector",
              "config": "{\"sls_project_name\":\"\"}"
            },
            {
              "name": "nginx-ingress-controller",
              "config": "{\"IngressSlbNetworkType\":\"internet\",\"IngressSlbSpec\":\"slb.s2.small\"}"
            },
            {
              "name": "ack-node-local-dns"
            },
            {
              "name": "arms-prometheus"
            },
            {
              "name": "alicloud-monitor-controller",
              "config": "{\"group_contact_ids\":\"[2066]\"}"
            }
          ],
          "cluster_spec": "ack.pro.small",
          "load_balancer_spec": "slb.s2.small",
          "os_type": "Linux",
          "platform": "AliyunLinux",
          "image_type": "AliyunLinux",
          "runtime": {
            "name": "containerd",
            "version": "1.4.8"
          },
          "charge_type": "PostPaid",
          "vpcid": {
            "Ref": "VpcId"
          },
          "container_cidr": "10.9.0.0/16",
          "service_cidr": "172.16.0.0/16",
          "vswitch_ids": {
            "Ref": "VSwitchIds"
          },
          "key_pair": {
            "Ref": "KeyPairName"
          },
          "logging_type": "SLS",
          "cpu_policy": "none",
          "is_enterprise_security_group": true,
          "controlplane_log_ttl": "30",
          "controlplane_log_components": [
            "apiserver",
            "kcm",
            "scheduler",
            "ccm"
          ],
          "nodepools": [
            {
              "nodepool_info": {
                "name": "default-nodepool"
              },
              "scaling_group": {
                "vswitch_ids": {
                  "Ref": "VSwitchIds"
                },
                "system_disk_category": "cloud_efficiency",
                "system_disk_size": 120,
                "system_disk_performance_level": "",
                "data_disks": [],
                "instance_types": [
                  "ecs.i2ne.xlarge"
                ],
                "tags": [],
                "instance_charge_type": "PostPaid",
                "soc_enabled": false,
                "key_pair": {
                  "Ref": "KeyPairName"
                },
                "is_enterprise_security_group": true,
                "platform": "AliyunLinux",
                "image_id": "aliyun_2_1903_x64_20G_alibase_20210726.vhd",
                "image_type": "AliyunLinux",
                "rds_instances": []
              },
              "kubernetes_config": {
                "cpu_policy": "none",
                "labels": [],
                "runtime": "containerd",
                "runtime_version": "1.4.8"
              },
              "count": 3
            }
          ],
          "num_of_nodes": 0
        }
      }
    }
  },
  "Outputs": {
    "TaskId": {
      "Description": "Task ID. Automatically assigned by the system, the user queries the task status.",
      "Value": {
        "Fn::GetAtt": [
          "AnyCluster",
          "TaskId"
        ]
      }
    },
    "ClusterId": {
      "Description": "Cluster instance ID.",
      "Value": {
        "Fn::GetAtt": [
          "AnyCluster",
          "ClusterId"
        ]
      }
    },
    "ScalingGroupId": {
      "Description": "Scaling group id",
      "Value": {
        "Fn::GetAtt": [
          "AnyCluster",
          "ScalingGroupId"
        ]
      }
    },
    "ScalingRuleId": {
      "Description": "Scaling rule id",
      "Value": {
        "Fn::GetAtt": [
          "AnyCluster",
          "ScalingRuleId"
        ]
      }
    },
    "DefaultUserKubeConfig": {
      "Description": "Default user kubernetes config which is used for configuring cluster credentials.",
      "Value": {
        "Fn::GetAtt": [
          "AnyCluster",
          "DefaultUserKubeConfig"
        ]
      }
    },
    "WorkerRamRoleName": {
      "Description": "Worker ram role name.",
      "Value": {
        "Fn::GetAtt": [
          "AnyCluster",
          "WorkerRamRoleName"
        ]
      }
    },
    "ScalingConfigurationId": {
      "Description": "Scaling configuration id",
      "Value": {
        "Fn::GetAtt": [
          "AnyCluster",
          "ScalingConfigurationId"
        ]
      }
    },
    "PrivateUserKubConfig": {
      "Description": "Private user kubernetes config which is used for configuring cluster credentials.",
      "Value": {
        "Fn::GetAtt": [
          "AnyCluster",
          "PrivateUserKubConfig"
        ]
      }
    },
    "Nodes": {
      "Description": "The list of cluster nodes.",
      "Value": {
        "Fn::GetAtt": [
          "AnyCluster",
          "Nodes"
        ]
      }
    }
  }
}