- Worker Nodes [EC2 Instance]
- Master Node [EC2 Instance]
- Worker Nodes Security Group [Security Group]
- Master Node Security Group [Security Group]
- User defines the number of worker nodes desired for the cluster.
- Terraform creates 2 Secuirty Groups by dynamically attaching it to the default VPC.
- Terraform will search for the latest Ubuntu AMI.
- Terraform will create the EC2 Instances along with the Security Groups.
These have been hardcoded to save costs. WorkerNodes = "t2.micro" MasterNode = "t2.medium"
- Worker Node IPs
- Master Node IP
- Master Node SSH String
- AMI Name
All resources are built and tested using Terraform, and stored in Github.
- AWS Account
- Basic AWS Knowledge
- Basic Terraform Knowledge
Download this repo to your local machine or clone the repo.
terraform init
terraform fmt
terraform validate
terraform plan
terraform apply
- After the terraform process has been completed. The Terraform command will provide the join token that will be used to attach worker nodes to the master node.
EXAMPLE:
sudo kubeadm join IP-ADDRESS:PORT --token
--discovery-token-ca-cert-hash sha256:
- Copy the Join Token.
- SSH into the Worker Nodes and Enter the Join Token using root (sudo).
- Go back to Master node and enter "kubectl get nodes". If the worker nodes are successfully joined, the above command should show all the worker node along with the master node in "Ready" state.
- Go to AWS, and search for EC2
- In EC2 Instances, you will see the worker nodes along with the master node.
- You can also check out the Security Groups by going to the Security Group page.
terraform destroy