This project uses Terraform and Ansible to automate the provisioning and configuration of a Kubernetes cluster on AWS. With a single command, you can create a cluster of any size and have it fully configured automatically.
This solution is ideal for developers and DevOps engineers who want to quickly provision AWS infrastructure and manage it using Infrastructure as Code (IaC) tools.
- Automated Cluster Provisioning – Deploy an AWS-based cluster with any number of worker nodes.
- Infrastructure as Code – Manage infrastructure using Terraform.
- Automated Configuration – Configure cluster nodes automatically with Ansible.
- Easy to Use – Launch the entire setup with a single
makecommand. - Customizable – Easily modify configuration values to fit your environment.
Before getting started, make sure the following tools are installed on your machine:
git clone https://github.com/ayumusakdiken/maker-cluster.git
cd maker-clusterBefore running the deployment, update the following configuration values according to your environment:
Set your preferred AWS region in:
main.tf
The default instance type is t3.medium.
If you want to use a different instance type or deploy in a region where t3.medium is unavailable, update the instance_type variable in:
ec2-instance.tf
Update the PRIVATE_KEY_PATH variable in the Makefile:
PRIVATE_KEY_PATH=/path/to/your/private-key.pemThis key will be used by Ansible to connect to the EC2 instances.
Terraform uses AWS CLI credentials to authenticate with AWS.
If you have not configured AWS CLI yet, run:
aws configureProvide your:
- AWS Access Key ID
- AWS Secret Access Key
- Default Region
- Output Format
Verify that your credentials have sufficient permissions to create AWS resources.
Run:
makeYou will be prompted to enter the number of worker nodes:
How many worker nodes would you like to create?
After entering the desired number, Terraform will provision the infrastructure and Ansible will automatically configure the cluster.
makeCreates the infrastructure and configures the cluster.
make updateReinitializes Terraform modules/providers and reapplies the configuration.
make outGenerates the Ansible inventory file from Terraform outputs.
make kubeconfigDownloads and updates the kubeconfig file without reconfiguring the entire cluster.
make cleanRemoves all AWS resources created by Terraform.
make cacheRemoves Terraform state files, lock files, and generated Ansible artifacts.
