Alicloud Kubernetes cluster autoscaling with Terraform

11/28/2018

Is there anyone who successfully implemented Kubernetes cluster autoscaling with Terraform in Alicloud? Is it possible with Terraform?

-- Nicolas Bilokonenko
alibaba-cloud
autoscaling
kubernetes
terraform

1 Answer

11/28/2018

You can deploy Container Service clusters on Alibaba Cloud by using Terraform Here is how you can install Terraform on Alibaba Cloud.

  • You must activate Alibaba Cloud Container Service.
  • You must activate Alibaba Cloud Container Service and create an AccessKey for your account. Keep your AccessKey ID and AccessKey Secret properly.

Download Terraform from the official website. Select the corresponding version and platform. In this document, install the Terraform on Linux (the procedure is similar to that of installing the Terraform on Mac OS X).

  • Under Linux, click to download the terraform_0.11.3_linux_amd64.zip file.
  • Copy the .zip file to an appropriate path (/usr/local/terraform in this example).
  • Extract the .zip file and then get a binary file terraform.
  • Create the following entries in the /etc/profile directory and add the path where the binary file resides (/usr/local/terraform in this example) to the PATH environment variable.

export TERRAFORM_HOME=/usr/local/terraform

export PATH=$PATH:$TERRAFORM_HOME

Install Alibaba Cloud Terraform package

Before using Terraform, an initialization operation is required to load Alibaba Cloud Provider. Run the following command in the template file directory:

terraform init

After the download is successful, the corresponding plugin is downloaded to the .terraform hidden directory in the current folder. If you encounter a network timeout problem during the loading process, follow the instructions to complete the manual installation of the plugin.

  • Download the corresponding version and platform Provider from Alibaba Cloud Terraform Provider official download address. In this example, the Linux type is selected.
  • Copy the downloaded file terraform-provider-alicloud_1.9.3_linux_amd64.zip to the Terraform installation directory /usr/local/terraform and extract it. The current directory gets Alibaba Cloud Provider terraform-provider-alicloud_v1.9.3_x4. Run the following command to test the working of Terraform. If Terraform is successfully installed, the following contents are displayed:

$ terraform Usage: terraform [--version] [--help] [args]

The available commands for execution are listed below. The most common, useful commands are shown first, followed by less common or more advanced commands. If you're just getting started with Terraform, stick with the common commands. For the other commands, please read the help and docs before usage.

Common commands: ....

All other commands: debug Debug output management (experimental) force-unlock Manually unlock the terraform state state Advanced state management

For more details Click here for Alibaba Cloud Terraform Documentation

-- Ashly Taylor
Source: StackOverflow