Kubernetes, IBM Cloud Private, and Vagrant, oh my!

Tim Pouyer
IBM Cloud
Published in
5 min readSep 29, 2017

So you want to run Kubernetes on your desktop?

kubernetes

Odds are that you already have Minikube running locally, but what if I told you that you can have a full-fledged, multi-node Kubernetes cluster running on your desktop in a matter of minutes? Does that pique your interest? I’ll show you how.

In June of 2017, IBM released into the wild its first foray into the local Kubernetes runtime product space, IBM Cloud Private.

IBM Cloud Private

Being the “eager beaver” I usually am, I quickly downloaded the product and installed it. The installation was quick and easy thanks to a rather innovative method of utilizing a Docker container. I downloaded the container, which contains a set of Ansible playbooks that run through the downloaded Docker container to perform the install, from Docker Hub and was installing IBM Cloud Private in moments. So now I had IBM Cloud Private installed and running, but I was paying for the cloud that I was running it. My years of developer experience rebelled against this situation, and I knew that I needed to make IBM Cloud Private run on my laptop. I’d tried Minikube, but IBM Cloud Private offers a fully-fledged Kubernetes cluster runtime. “How could I put this on my laptop,” I wondered. I decided to take a page from a previous project I worked on to put OpenStack on a laptop. LXD.

LXD the linux container hypervisor

It’s time for a quick history lesson. Several years ago, Ubuntu began a project to refresh the now decade-old Linux Container Project, or LXC. (Docker built its containers and runtime projects on top of LXC. Docker’s brilliant move was to make LXC “portable” with its genius packaging concept, the Docker image. Before Docker, LXC was hard to use, hard to configure and install, and had many variations in its level of support across linux vendors. Docker solved those problems with its innovative packaging and revolutionized the industry. But I digress.) So Ubuntu began a project to refresh LXC. They called this project LXD. The goal was to take a page from Docker’s packaging playbook and make LXC easier to use and consistent across the many Linux distributions. LXD is not a competing product with Docker. Docker is a form of “process container,” meaning that it isolates a single process in the container, whereas LXD is a “system container,” meaning that it isolates the entire operating system. In practice, LXD operates much like a hypervisor does today except that you get the increased density and decreased latency benefits of Linux containers. To quote Ubuntu, LXD is “a pure-container hypervisor that runs unmodified Linux guest operating systems with VM-style operations at incredible speed and density”.

LXD vs. Docker

Because I’d used it before, when thinking about the problem of how I can get IBM Cloud Private onto my laptop, LXD seemed to be the obvious choice. LXD runs natively on many Linux operating systems but does not run on macOS, which my laptop uses. So I needed a way to run Linux (namely Ubuntu) on my Mac, or any other operating system. So the next obvious choice was Vagrant. Utilizing Vagrant, I could easily stand up a Ubuntu VM running in VirtualBox via the command line and then install IBM Cloud Private on top of it. But there’s more… once installed I could then stop, start, suspend, and even resume the VM as needed so that it didn’t consume any more resources than was absolutely necessary on my laptop. I thought to myself, “This is fantastic. I can use Vagrant to stand up a VM and install IBM Cloud Private onto it and utilize LXD within the VM to install IBM Cloud Private worker nodes running in a containerized hypervisor of sorts. Yeah this should be fantastic!” Well, it wasn’t as simple as that, but I did manage to do exactly that, I now have a Vagrantfile that I use with Vagrant to stand up a single VirtualBox VM and within it run two LXD containerized Ubuntu machines. On the VirtualBox VM, I installed the master and proxy nodes for the IBM Cloud Private cluster and on the additional two LXD container machines, I installed two worker nodes. The entire setup gives me a true three node Kubernetes cluster that I can run on my laptop in just 4GiB of RAM and 20 GiB of hard drive space! And since I’m bridging the VirtualBox network with a host-only network on my laptop, I can utilize the native terminal on my Mac to run any kubectl or helm commands I want against the IBM Cloud Private cluster.

Vagrant

So you might be thinking, “Yeah that’s great for you. What about me?”. Well I’m happy to tell you that we are now sharing the setup described above with you. Do you want a full-fledged Kubernetes clustered runtime running on your laptop? Do you want to see how I’m using LXD and Vagrant to make this possible? Do you want to try out IBM Cloud Private quickly and easily? Well now you can. We are sharing the Vagrantfile on GitHub for everybody to use under an Apache Version 2.0 license at Deploy IBM Cloud Private beta.

Go clone the repository on GitHub. Try it out for yourself. Oh, and please provide us feedback on your experience by joining the IBM Cloud Private community or our Slack channel to ask questions of our developers who are building the next generation on-premises Kubernetes platform right now.

--

--

Tim Pouyer
IBM Cloud

You can not gain value from software that has not been deployed!