Skip to content

Instantly share code, notes, and snippets.

@jimmycuadra
Created September 25, 2015 11:01
Show Gist options
  • Save jimmycuadra/31689e4c411d7927d91c to your computer and use it in GitHub Desktop.
Save jimmycuadra/31689e4c411d7927d91c to your computer and use it in GitHub Desktop.
KubeCon proposal: Deploying Kubernetes Clusters with Terraform and CoreOS

Deploying Kubernetes Clusters with Terraform and CoreOS

Kubernetes is complex software and setting up a new cluster can be difficult. While there are easy approaches like Google Container Engine, you may want to customize your cluster in various ways, or simply understand how it all works. A great way to do this is to define your cluster as code using Terraform. In this talk, you'll learn how to use Terraform to deploy Kubernetes on CoreOS and EC2.

Takeaway

Terraform and CoreOS are a great combination for deploying Kubernetes clusters.

Abstract

Kubernetes is a fantastic system for deploying modern applications, but it is quite complex and can be challenging to understand at a deep level. The first step in using Kubernetes is to deploy a new cluster, but there are many variables in choosing where and how to do it: multiple cloud platforms, bare metal, multiple operating systems and distributions, and various combinations of infrastructure topology. There are a few approaches that are relatively easy, namely using the Google Container Engine hosted platform or using the shell scripts that ship with Kubernetes itself. But if you want to do anything beyond that, or you just want to get a better understanding of the various components of Kubernetes and how they're all wired together, how do you start? How can you maintain better control of your Kubernetes infrastructure if you want to host it yourself but don't want to run massive shell scripts with no idea what they're doing?

A great way to deploy Kubernetes is to define all your infrastructure using a tool from HashiCorp called Terraform. Terraform allows you to define all your cloud infrastructure in declarative configuration files which are kept under source control. Once you've written your configuration, Terraform creates a graph of all your resources and their dependencies on each other, and forms a plan that it will run to create them. Applying the plan creates all the resources, such as servers, security groups, and networking components, and stores the resulting state in a file which you commit to source control. When you need to make changes to your infrastructure, you update your configuration files with the desired state, and apply the new plan to make any necessary changes.

This presentation will walk through the details of deploying a new Kubernetes cluster with the infrastructure defined in Terraform configuration, then deployed to CoreOS instances in Amazon EC2. CoreOS is a distribution of Linux specifically designed for running containerized applications, and is a perfect fit as the host system for Kubernetes. By the end of the presentation, you'll have a better understanding of the structure of a Kubernetes deployment, you'll see the power of Terraform for managing your infrastructure, and you'll see the benefits CoreOS brings with features like distributed configuration, fault tolerance, and tight systemd integration.

@ddgnani
Copy link

ddgnani commented Sep 27, 2015

Can't agree more - "How can you maintain better control of your Kubernetes infrastructure if you want to host it yourself but don't want to run massive shell scripts with no idea what they're doing?"

I am a fan of Terraform templates and looking for this presentation and scripts to create kubernetes cluster in AWS - especially to make it work on a given VPC and subnets. I'm curious as to what overlay networking you would be choosing for AWS EC2 cluster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment