The Cluser Autoscaler uses EC2 Auto-Scaling Groups to configure the instances it launches when it determines additional worker nodes are necessary. Auto-Scaling Groups have an associated Launch Template, which describes the properties of the instances, such as AMI ID, instance type, security groups, etc. When instances are first launched, they need to be configured to join the on-premises Kubernetes cluster. This is handled by *cloud-init* using the configuration in the instance user data. The configuration supplied here specifies the Fedora packages that need to be installed on a Kubernetes worker node, plus some additional configuration required by `kubeadm`, `kubelet`, and/or `cri-o`. It also includes a script that fetches the WireGuard client configuration and connects to the VPN, finalizes the setup process, and joins the cluster. |
||
---|---|---|
.. | ||
.gitattributes | ||
.gitignore | ||
.terraform.lock.hcl | ||
README.md | ||
asg.tf | ||
eventbridge.tf | ||
iam-policy.json | ||
main.tf | ||
sns.tf | ||
terraform.tfstate | ||
userdata.yml | ||
variables.tf |
README.md
Configuring AWS Using Terraform
Prerequisites
The IAM user or role that runs Terraform must have the appropriate permissions.
The iam-policy.json
file defines a policy that will allow the Terraform to
manage all of the necessary resources. Before running Terraform, create an IAM
policy and assign it to a user, group, or role. Be sure to replace the AWS
account ID in the various target resource names.
To use an IAM role, set the iam_role
Terraform variable when executing
terraform plan
/terraform apply
.
Create Resources
Terraform will create all resources automatically:
terraform apply