How to deploy a Kubernetes cluster using Terraform and Ansible on AWS: Use EC2 or EKS

Amlan Chakladar
1 min readJul 24, 2022

--

While I was in the initial stages of learning Kubernetes, I always struggled to get a quick Kubernetes cluster to work on my practice labs. Though there are many online alternatives available which can be used in such scenarios but somehow I always felt if I could easily spin up a lab environment of my own, it will be good for my learning. Thats when I came up with this process to spin up a basic Kubernetes cluster easily and quickly. The process described here can be a good learning to use Terraform and Ansible in such scenarios too. With modifications to the steps, this can also be used to launch actual clusters in projects.

For this post, I will go through the process of spinning up a basic Kubernetes cluster using Terraform on AWS. I will cover two ways to launch the cluster:

  • Using Terraform to launch EC2 instances on AWS and use Ansible to bootstrap and start a Kubernetes cluster
  • Using Terraform launch an AWS EKS cluster

More details about the post can be found here: https://amlanscloud.com/terrakubedeploy/

--

--

Amlan Chakladar

Cloud architect and DevOps engineer. Love to code and develop new stuff. A nerd by nature.