Kubernetes Tutorial: Continuous Delivery with Terraform

Tutorial for Terraform and Kubernetes

Working with hundreds of our DevOps customers, I’ve found a winning combination of tools that will give you more time to focus on the stuff that really matters.  Of course, there are other options, but this is what I’ve seen working really well. Let’s dive in to the different tools and then see how we bring them all together.

One Terraform to Rule All Clouds

With IaC (Infrastructure as code) allowing you to store your code, you can then version it using source version (e.g. with Github), and with a CI/CD pipeline, easily create a new test, staging or production environment. Hashicorp’s Terraform, one popular and powerful IaC platform, helps with provisioning and creating an infrastructure form code that supports any cloud provider. 

Kubernetes Control Plane Made Easy with Amazon’s EKS

With AWS Elastic Kubernetes Service (EKS) your K8s control plane is completely managed with Amazon taking care of availability, patches and security. EKS is possibly the fastest and easiest way to create a K8s cluster. In just a few steps you can get a production-grade cluster running.

Kubernetes Workers Fully Managed with Spotinst Ocean

Spotinst Ocean is our product for managing Kubernetes workers in a seamless way (and for saving you up to 90% on your EC2 costs).

With intelligent, container-driven scaling, Ocean will launch for you the best possible instance types and sizes, to perfectly match your Pods’ CPU and Memory requirements.

We will now create EKS and Ocean in one Terraform template and create a cost-saving K8s cluster for production-grade deployments.

  1. Clone this repo folder.
  2. Fill the terraform.tfvars with all the parameters.
  3. Terraform apply.
  4. In the output of the folder will be a file – kubeconfig_EKS-<Your cluster name>
    This is the kubeconfig for interacting with the EKS.

That’s it. You now will have launched your Kubernetes cluster in the fastest and easiest way possible.