全部產品
Search
文件中心

:ALIYUN::CS::AnyCluster

更新時間:Jun 08, 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"
        ]
      }
    }
  }
}