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

语法

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

属性

属性名称 类型 必须 允许更新 描述 约束
ClusterConfig Map 集群配置。 更多信息,请参见创建Kubernetes集群的API。例如:创建一个Kubernetes托管版集群实例,请参见创建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。

示例

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列表"
      }
    },
    "Name": {
      "Type": "String",
      "Description": {
        "en": "Naming rule: The name contains 1 to 63 digits, Chinese characters, English characters, and hyphens (-), and cannot start with a hyphen (-).",
        "zh-cn": "命名规则:由数字、汉字、英文字符或短划线(-)组成,长度范围1~63个字符,且不能以短划线(-)开头。"
      },
      "Label": {
        "en": "cluster name",
        "zh-cn": "集群名称"
      },
      "Default": "cluster-demo"
    },
    "KubernetesVersion": {
      "Type": "String",
      "Label": {
        "en": "Kubernetes Version",
        "zh-cn": "集群版本"
      },
      "Description": {
        "en": "The version of the Kubernetes cluster.",
        "zh-cn": "Kubernetes集群的版本。"
      },
      "Default": "1.22.3-aliyun.1"
    },
    "ClusterSpec": {
      "Type": "String",
      "Label": {
        "en": "Cluster Spec",
        "zh-cn": "集群类型"
      },
      "Description": {
        "en": "Cluster type, for managed clusters. Values:\nack.pro.small: Professionally managed cluster, that is, \"ACK Pro edition cluster\".\nack.standard: Standard managed cluster.",
        "zh-cn": "托管版集群类型,面向托管集群。取值:\nack.pro.small:专业托管集群,即:”ACK Pro版集群“。\nack.standard:标准托管集群。"
      },
      "AllowValues": [
        "ack.pro.small",
        "ack.standard"
      ],
      "Default": "ack.pro.small"
    },
    "NodeCidrMask": {
      "Type": "String",
      "Label": {
        "en": "Node Cidr Mask",
        "zh-cn": "节点IP数量"
      },
      "Description": {
        "en": "You can specify the network CIDR to determine the number of IP addresses. This takes effect only for Flannel network clusters.",
        "zh-cn": "通过指定网络的CIDR来确定IP的数量,只对于Flannel网络类型集群生效。"
      },
      "Default": "26"
    },
    "ProxyMode": {
      "Type": "String",
      "Label": {
        "en": "Proxy Mode",
        "zh-cn": "kube-proxy代理模式"
      },
      "Description": {
        "en": "The iptables and ipvs modes are supported.",
        "zh-cn": "支持iptables和ipvs两种模式。"
      },
      "AllowValues": [
        "iptables",
        "ipvs"
      ],
      "Default": "ipvs"
    },
    "LoadBalancerSpec": {
      "Default": "slb.s2.small",
      "AssociationProperty": "ALIYUN::SLB::Instance::InstanceType",
      "Type": "String",
      "Description": {
        "zh-cn": "负载均衡实例规格",
        "en": "SLB Instance specifications."
      },
      "Label": {
        "zh-cn": "规格",
        "en": "Specifications"
      }
    },
    "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": {
            "Ref": "Name"
          },
          "cluster_type": "ManagedKubernetes",
          "disable_rollback": true,
          "timeout_mins": 60,
          "kubernetes_version": {
            "Ref": "KubernetesVersion"
          },
          "region_id": {
            "Ref": "ALIYUN::Region"
          },
          "snat_entry": true,
          "cloud_monitor_flags": true,
          "endpoint_public_access": false,
          "deletion_protection": true,
          "node_cidr_mask": {
            "Ref": "NodeCidrMask"
          },
          "proxy_mode": {
            "Ref": "ProxyMode"
          },
          "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": {
            "Ref": "ClusterSpec"
          },
          "load_balancer_spec": {
            "Ref": "LoadBalancerSpec"
          },
          "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,
                "cis_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示例YAML示例