Local Kubernetes

First encounter with the pilot

If you are wondering for a while what Kubernetes and how I get it locally, this could be a good place to start.

Well, no really, if you want to start with Kubernetes, I would recommend reading a bit about it before getting to your local single-node cluster. Here are some free resources to get you started:

Introduction to Kubernetes: Great introductory course is walking through all basic concepts. EdX hosts it with chapter’s knowledge checks and a final exam. Nothing to be scared of it, but it is nice to check if you understand everything correctly. You can finish the course in around 10 hours.

Kubernetes the hard way: Written by Kelsey Hightower, It a GitHub-repo tutorial very oriented to learn and understand everything about Kubernetes in details. It has a strong dependency on Google Compute Cloud, but it worth trying if you want to understand more than the basics.

After reviewing some material, you are ready to start creating your local cluster, and, basically, you don’t need the rest of this page, but there are always some tweaks here and there that could be useful. We have at least two options to install a local single-node Kubernetes cluster:

Minikube: It is easy to use and widely supported way to install it. There is a lot of documentation just by google-ing it. It will create a VM and install Kubernetes on it. It can be used with VirtualBox as the hypervisor; so, we are all happy. It has the complexity of a VM, meaning it is not localhost, but I would recommend it.

Docker for Mac(Edge): The Edge version of Docker for Mac can enable a Kubernetes cluster. If you have it, it is straightforward to activate, and it will be accessible from localhost. The only problem is that it is more involved in the sense that it is not as easy to use as Minikube. For example, the Kubernetes dashboard needs to be installed manually. Here is a good tutorial on how to set it up.

As an example, I will be describing here the steps to set up a TICK stack on your local single-node Kubernetes cluster on a Mac with Homebrew.

You need to be connected to the Internet as it will be downloading the iso needed to create the VM. It will take a while. Especially, if you are at the office. When it is done, you can check the cluster status with:

Step 2: Install helm and some charts

Why install this when we can configure everything with kubectl? Sure, we can do that, but it is a long road. Helm is a package manager for Kubernetes, and it will make our life easier. We just brew it like this:

brew install kubernetes-helm

Helms “packages” or application are called charts. We can get some charts from a Github repo until we have our own:

git clone https://github.com/kubernetes/charts.git

Change directory to charts/stable. Each directory there is a chart for us to use.

Step 3: Installing the TICK

We need to install four pods to have the TICK stack running: Influxdb, Telegraf, Chronograf, and Kapacitor.

[Source: https://www.influxdata.com/time-series-platform/]

We have the charts on the repo we just clone, but we need some adjustment to them first:

On the file stable/kapacitor/values.yaml, find the line starting with influxURL and uncomment it.