A terraform example to launching a kubernetes cluster in alibaba cloud.
These types of the module resource are supported:
This example can specify the following arguments to create user-defined kuberntes cluster
- alicloud_access_key: The Alicloud Access Key ID
- alicloud_secret_key: The Alicloud Access Secret Key
- region: The ID of region in which launching resources
- k8s_name_prefix: The name prefix of kubernetes cluster
- worker_number: The number of worker nodes in each kubernetes cluster
- k8s_pod_cidr: The kubernetes pod cidr block. It cannot be equals to vpc's or vswitch's and cannot be in them. If vpc's cidr block is
172.16.XX.XX/XX
, it had better to192.168.XX.XX/XX
or10.XX.XX.XX/XX
- k8s_service_cidr: The kubernetes service cidr block. Its setting rule is same as
k8s_pod_cidr
- Other kubernetes cluster arguments
Note: In order to avoid some needless error, you had better to set new_nat_gateway
to true
.
Otherwise, you must you must ensure you specified vswitches can access internet before running the example.
Planning phase
terraform plan
Apply phase
terraform apply
Destroy
terraform destroy
This example can support the following creating kubernetes cluster scenario by setting different arguments.
You can specify the following user-defined arguments:
- vpc_name: A new vpc name
- vpc_cidr: A new vpc cidr block
- vswitch_name_prefix: The name prefix of several vswitches
- vswitch_cidrs: List of cidr blocks for several new vswitches
You can specify the following user-defined arguments:
- vpc_id: A existing vpc ID
- vswitch_ids: List of IDs for several existing vswitches
You can specify the following user-defined arguments:
- vpc_id: A existing vpc ID
- vswitch_ids: List of IDs for several existing vswitches
- new_nat_gateway: Set it to false. But you must ensure you specified vswitches can access internet. In other words, you must set snat entry for each vswitch before running the example.
Terraform version 0.11.0 or newer and Provider version 1.57.2 or newer are required for this example to work.
Created and maintained by Meng Xiaobing(@menglingwei, [email protected])
Mozilla Public License 2.0. See LICENSE for full details.