Kapitan — rise and shine

D. Heinrich
Kapitan Blog
Published in
3 min readFeb 4, 2021

I searched for a new tool. Which we can use to ease our Kubernetes configuration management. Here is why I will use Kapitan over Helm, Kustomize or Pulumi.

Why Kapitan?

I searched for a new tool. Which we can use to ease our Kubernetes configuration management. Therefore I personally tested Helm, Kustomize, Pulumi and Kapitan. The duration of every tool test where around one to two weeks.

Helm for me personally was likely the same as Jinja2-templating but in go-templating. Yes I know it is much more but not for my intentions. So I saw not much benefit to switch to it.

Kustomize is a great tool but it requires us to duplicate to much and has more likely a multistage approach.

Pulumi is very powerful when you’re into coding. I did not quite get into it since I’m not a developer or something near it.

Kapitan to me is something like the best of all tools together. It brings a ton of abilities into the mix. You are not bound to one specific templating and can even get use of 3rd parties like helm. You are able to override certain configurations if you need a per stage approach. Kapitan also allows you to generate documentation with the same command.
So as you may get why we decided to get more committed to Kapitan.

by kapitan.dev

Where do we come from?

We currently rendering our Kubernetes templates using a mix of multiple repositories:

  1. Ansible Role for rendering + deployment
  2. Kubernetes configuration templates + value and overrides files
  3. Secrets packages in Ansible-vault which are rendered on top of step 2.

This works pretty well for our current project. But its hard to adopt it to other projects. Also for our internal infrastructure we’re currently on the move from traditional virtual machines into Kubernetes.

So the problem with this approach is that we are very specific with the Ansible-Roles and configurations which can hardly be reused. This is why I decided to search for another tool which can help us out here.

Where to start with Kapitan?

You want to get your hands on with Kapitan? Well lets get it going

Wrap your head around their blog posts

These posts are a good starting point, since they are made by developer and so you can get an Idea of what Kapitan is capable of:

Watch the Introduction video to Kapitan

Make use of the Kapitan reference examples

When you have an idea of how Kapitan can help you, then you might want to get it going for the first time.
The maintainer prepared a reference-repository where you can find examples hopefully for your https://github.com/kapicorp/kapitan-reference

$ git clone https://github.com/kapicorp/kapitan-reference.git
Cloning into 'kapitan-reference'...
[...]
$ cd kapitan-reference
$ ./kapitan compile
Compiled examples/global (0.32s)
Compiled examples/mysql (0.34s)
Compiled examples/postgres-proxy (0.35s)
Compiled examples/pritunl (0.37s)
Compiled examples/gke-pvm-killer (0.13s)
Compiled examples/tutorial (0.16s)
Compiled examples/echo-server (0.17s)
Compiled examples/examples (0.16s)
Compiled kapicorp/tesoro (0.17s)
Compiled examples/sock-shop (0.38s)
Compiled kapicorp/dev-sockshop (0.35s)
Compiled kapicorp/prod-sockshop (0.36s)

This pull the currently latest docker image of Kapitan and render all the examples for you.

Congrats! You run your first successful compilation of Kapitan. You can now explore the examples and their compiled artefacts.

by kapitan.dev

Is that all?

Hopefully not!
I’d like to post full example of how you can achieve certain goals with Kapitan. At first I’d like to start on how you can adopt the Kapitan features one by one. Meaning that I will show you how to work with secrets, configmaps, render documentation and how you can easily adopt helm charts with Kapitan.

Cheers

Sources:

--

--

D. Heinrich
Kapitan Blog

Working as a Head of Infrastructure at Flower Labs.