Infrastructure as code — for developers

Vagmi Mudumbai
Sep 26, 2018 · 3 min read

As developers, we are fairly conversant with CI systems so I am going to scope it out of this post. This is a quick introduction to three tools that you really need to know if you are a developer looking to get into operations.

Terraform

Ansible

  • It should not require an agent
  • It should be simple and extensible
  • It should be easy to integrate with other tools like Terraform and Packer.

Ansible uses YAML to declare the state of the machine. While terraform works at the level of cloud resources, Ansible uses modules for effecting chages on the machine like installing APT packages, copying files or running arbitrary commands. There is a digital ocean tutorial on creating a kubernetes cluster with ansible. It gives a good understanding of how a moderately complex Ansible script looks like.

Packer

Workflow

  • Controller — This contains etcd, API server, controller manager and scheduler.
  • Node — This contains docker, kubelet and kubeproxy

We’ll initially use packer and ansible to create an image that has the binaries and packages installed. It will not have the services configured or the certificates or kubeconfig files.

We’ll then write a separate set of playbooks that will create certificates locally on the build machine and use terraform to launch nodes and then call ansible playbooks to setup the nodes it creates by passing in these configuration variables to ansible. Ansible will generate certificates locally for the IP addresses for the nodes and setup kubeconfig files that point to it. It would also setup systemd service definitions and start them. As a follow up post, we are create a Kubernetes cluster on DigitalOcean with Terraform, Ansible and Packer. Click on the follow button to get notified on our blog posts.

Follow up posts:

Tarka Labs Blog

Tarka Labs is a team of passionate hackers, designers and…

Vagmi Mudumbai

Written by

Building an awesome team @tarkalabs. Hacks on golang, kubernetes and vim.

Tarka Labs Blog

Tarka Labs is a team of passionate hackers, designers and product managers. We believe in experimental methods to identify the best solutions to problems instead of working on technology du jour. Visit us at https://tarkalabs.com/

Vagmi Mudumbai

Written by

Building an awesome team @tarkalabs. Hacks on golang, kubernetes and vim.

Tarka Labs Blog

Tarka Labs is a team of passionate hackers, designers and product managers. We believe in experimental methods to identify the best solutions to problems instead of working on technology du jour. Visit us at https://tarkalabs.com/

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store