alicloud_cs_edge_kubernetes

This resource will help you to manage a Edge Kubernetes Cluster in Alibaba Cloud Kubernetes Service, see What is edge kubernetes.

Example Usage

Basic Usage

variable "name" {
  default = "tf-example-basic-edge"
}
data "alicloud_zones" "default" {
  available_resource_creation = "VSwitch"
}
data "alicloud_instance_types" "default" {
  availability_zone    = data.alicloud_zones.default.zones.0.id
  cpu_core_count       = 4
  memory_size          = 8
  kubernetes_node_role = "Master"
}

resource "alicloud_vpc" "default" {
  vpc_name   = var.name
  cidr_block = "10.4.0.0/16"
}
resource "alicloud_vswitch" "default" {
  vswitch_name = var.name
  cidr_block   = "10.4.0.0/24"
  vpc_id       = alicloud_vpc.default.id
  zone_id      = data.alicloud_zones.default.zones.0.id
}

resource "alicloud_cs_edge_kubernetes" "default" {
  name                         = var.name
  worker_vswitch_ids           = [alicloud_vswitch.default.id]
  worker_instance_types        = [data.alicloud_instance_types.default.instance_types.0.id]
  worker_number                = "1"
  password                     = "Test12345"
  pod_cidr                     = "10.99.0.0/16"
  service_cidr                 = "172.16.0.0/16"
  worker_instance_charge_type  = "PostPaid"
  new_nat_gateway              = "true"
  node_cidr_mask               = "24"
  install_cloud_monitor        = "true"
  slb_internet_enabled         = "true"
  is_enterprise_security_group = "true"
  worker_data_disks {
    category  = "cloud_ssd"
    size      = "200"
    encrypted = "false"
  }
}

You could create a professional kubernetes edge cluster now.

variable "name" {
  default = "tf_example"
}
data "alicloud_zones" "default" {
  available_resource_creation = "VSwitch"
}
data "alicloud_instance_types" "default" {
  availability_zone    = data.alicloud_zones.default.zones.0.id
  cpu_core_count       = 4
  memory_size          = 8
  kubernetes_node_role = "Master"
}

resource "alicloud_vpc" "default" {
  vpc_name   = var.name
  cidr_block = "10.4.0.0/16"
}
resource "alicloud_vswitch" "default" {
  vswitch_name = var.name
  cidr_block   = "10.4.0.0/24"
  vpc_id       = alicloud_vpc.default.id
  zone_id      = data.alicloud_zones.default.zones.0.id
}

resource "alicloud_cs_edge_kubernetes" "default" {
  name                         = var.name
  worker_vswitch_ids           = [alicloud_vswitch.default.id]
  worker_instance_types        = [data.alicloud_instance_types.default.instance_types.0.id]
  cluster_spec                 = "ack.pro.small"
  worker_number                = "1"
  password                     = "Test12345"
  pod_cidr                     = "10.99.0.0/16"
  service_cidr                 = "172.16.0.0/16"
  worker_instance_charge_type  = "PostPaid"
  new_nat_gateway              = "true"
  node_cidr_mask               = "24"
  load_balancer_spec           = "slb.s2.small"
  install_cloud_monitor        = "true"
  slb_internet_enabled         = "true"
  is_enterprise_security_group = "true"

  worker_data_disks {
    category  = "cloud_ssd"
    size      = "200"
    encrypted = "false"
  }
}

Argument Reference

Global params

Network params

Worker params

Computed params

You can set some file paths to save kube_config information, but this way is cumbersome. Since version 1.105.0, we've written it to tf state file. About its use,see export attribute certificate_authority. From version 1.187.0+, new DataSource alicloud_cs_cluster_credential is recommended to manage cluster's kube_config.

Removed params

addons

The addons supports the following:

The following example is the definition of addons block, The type of this field is list:

# install nginx ingress, conflict with SLB ingress
addons {
  name = "nginx-ingress-controller"
  # use internet
  config = "{\"IngressSlbNetworkType\":\"internet",\"IngressSlbSpec\":\"slb.s2.small\"}"
  # if use intranet, detail below.
  # config = "{\"IngressSlbNetworkType\":\"intranet",\"IngressSlbSpec\":\"slb.s2.small\"}"
}

worker_data_disks

The worker_data_disks supports the following:

log_config

The log_config supports the following:

Attributes Reference

The following attributes are exported:

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

Import

Kubernetes edge cluster can be imported using the id, e.g. Then complete the main.tf accords to the result of terraform plan.

$ terraform import alicloud_cs_edge_kubernetes.main cluster-id