You can use Terraform to create Container Service for Kubernetes (ACK) clusters in ACK, import the ACK clusters to Enterprise Distributed Application Service (EDAS), and then deploy applications in the ACK clusters. This topic provides information about available interfaces and a configuration example.
Interface description
Data Sources
alicloud_edas_applications: EDAS application data sources, including Elastic Compute Service (ECS) applications and ACK applications in EDAS.
alicloud_edas_clusters: EDAS cluster data sources, including ECS clusters and ACK clusters in EDAS.
Resources
alicloud_edas_k8s_cluster: imports an ACK cluster that is created in ACK to EDAS.
alicloud_edas_k8s_application: creates an application in an ACK cluster in EDAS.
Configuration example
In the following example, an application is deployed in an ACK cluster in EDAS. Modify configuration parameters as needed.
Create a managed Kubernetes cluster in ACK.
NoteTerraform allows you to create various types of clusters in ACK. In this example, only the managed Kubernetes cluster is used.
resource "alicloud_cs_managed_kubernetes" "default" { worker_instance_types = [data.alicloud_instance_types.default.instance_types.0.id] name = var.name worker_vswitch_ids = [alicloud_vswitch.default.id] worker_number = "1" password = "Test12345" pod_cidr = "172.20.0.0/16" service_cidr = "172.21.0.0/20" worker_disk_size = "50" worker_disk_category = "cloud_ssd" worker_data_disk_size = "20" worker_data_disk_category = "cloud_ssd" worker_instance_charge_type = "PostPaid" slb_internet_enabled = "true" }
Import the managed Kubernetes cluster to EDAS.
resource "alicloud_edas_k8s_cluster" "default" { cs_cluster_id = "xxxx-xxx-xxx" }
Create and deploy an application in the managed Kubernetes cluster.
resource "alicloud_edas_k8s_application" "default" { application_name = "shesheng-test-k8s" cluster_id = "45bc8232-3233-46be-ab20-6d4a9b506d5c" replicas = 1 package_type = "Image" image_url = "cr.registry.cloud.ste2.com/test/gw-provider:1028" command = "/bin/sh" command_args = ["-c", "while true; do echo hello; sleep 1000;done"] }