Running a Kubernetes Cluster in Vagrant with Kubeadm

Introduction

This post explains how to run a multiple-node Kubernetes cluster using kubeadm running on Vagrant. It assumes that you have a basic understanding of Vagrant and Kubernetes.

The main obstacle to running a Kubernetes cluster on Vagrant is that Vagrant and VirtualBox do not give you sensible IP addresses by default. You must create additional Network Interfaces and instruct Kubernetes to use them.

Here is a repo containing a working example: https://gitlab.com/helm108/kubernetes-vagrant-example

Read More

Objects, Prototypes and Memory Consumption

I recently read an article called Understand JavaScript Object Creation Patterns. The author talks about object prototypes and how declaring a function on an object will increase memory consumption versus putting that function on the object’s prototype, assuming you have more than one instance of the object.

This sounds quite obvious, but I became interested in learning how to prove this using Chrome’s developer tools, so I did.

Read More

Deploying helm108.com

So at this point I have:

  • A base snapshot on Digital Ocean that has my user and system-wide dependencies set up.
  • A deploy snapshot built from the base snapshot that is ready to receive and serve the projects running on the server.

Now I need to launch a Droplet using the deploy snapshot as its image, install and run each of my projects on that Droplet and then make them accessible via the configured domains.

Read More

Deploying my projects using Git

One of the main requirements of my server was that I would be able to deploy my projects with a git push, the same way that you can with Heroku, Dokku and similar. After a lot of experimenting this was what I ended up with:

  • When the deploy image is built a bare git repo is created for each project in /var/repos.
  • Each repo uses git hooks to install project dependencies, build the site and launch it with pm2.
  • A script is built that pulls each repo into /var/www.
  • Terraform populates various .env files and then runs the script as part of the server deployment.

Read More

Provisioning Images on Vagrant and Digital Ocean with Puppet

Provisioning Helm108

At this point in building my server for Helm108 I had a Vagrantfile running Ubuntu 16.04. My next step was to learn how to provision my server, and then get that provisioned image on to Digital Ocean. I initially followed these instructions for deploying to Digital Ocean from Vagrant but that didn’t seem like the right solution for a production deployment. At work we use Hashicorp’s suite of tools and as they’re all open source (and I could bother the devops team if I needed help) I decided to do the same.

After talking to said devops team I was recommended Puppet for my provisioning needs. Having no experience with this kind of thing that seemed reasonable so I went with it. I could have done more research and tried to judge the best tool for the job but with anything I do where I have no experience I typically just pick one and try that. I might hate my choice, but at least I now have better information with which to judge alternatives.

Read More