Kustomize a reasonable alternative to Helm Charts

First of all, I would like to tell you, I like so much Helm Charts, and I have great experiences using this tool.

The usability for the users is very impressive with a simple command everything is up and running. The community is very active and you can find many recipes at Github, we need to look carefully but in general, work, as expected.

I’ve deployed a couple of applications and I had very successful deployments with that tool, but in my first experience to “write” the recipe and I’ve found the truth. Templates a lot, much, many brackets everywhere and then I’ve got a little bit disappointed.

For sure it is not a big problem, because I do that one time, at the beginning of the project, after I need some improvements and keep the evolution.

When I start to write operation stuff for projects, every time I asked myself. There should a simple way to do that the same stuff.

Yes, I’ve found that tool, without a template, goodbye fu*** brackets I don’t like you. Also, that tool is more declarative than helm, I got my yaml if I need them, I don’t need to run something to get them.


Introducing Kustomize

From the kustomize website “Kustomize introduces a template-free way to customize application configuration that simplifies the use of off-the-shelf applications.”

It means there are no brackets anymore, there is no tool to “process” my recipe anymore and I have it on the kubectl tool, like a native for kubernetes.

Also, it brings the declarative way to create things, I’m able to navigate in my yamls and then find what is deployed in my kubernetes. Everything in kustomize is a plain yaml, all the people are able to read them. Humans and tools.

We need to follow a simple folder structure and a couple of new nodes in yaml, that is all as we need.

Let’s see how it works. I’ll show it on an open-source project called APIrator that helps developers to create API Mocks for development and tests purpose. The recipe will deploy it on the cluster.

Let’s understand a little bit deeper.

Kustomize Folder Structure

Before to understand how it works let’s explore the folder structure to organize our kubernetes manifests

I’ll use a simple example, that I’ve worked on the last couple days, the APIrator kustomize project

The folder structure should be like this

There are important folders here. The base folder and overlays.

It will consider our environments, we have two, development and production.

It is pretty simple to understand. The base folder contains the commons configuration which will be shared by different environments.

The overlays/development contains configuration for the development environment.

Finally, the overlays/production contains configuration for the production environment.

With kustomize, we are able to handle different environments, like the example below

Kustomize Files and Examples

In each folder has the kustomization.yaml file that describes some customizations. Let’s see the kustomization present on the base folder

As we can see we can define the commons labels for all resources prevenient from this recipe. The resources attribute lists all resources necessary to install this application.

The ConfigMaps declared as resource are treated the same way as other resources. Kustomize doesn’t append any hash to the ConfigMap name. The ConfigMap declared from a ConfigMapGenerator is treated differently. A hash is appended to the name and any change in the ConfigMap will trigger a rolling update.

Let’s see the kustomization for the production environment

The bases attribute indicates the base for this customization

The patchesStrategicMerge indicates the names of the files that will be merged and generate the “updated” file with changed by the desired environment or overlay in our case.

Some important notes, the patchesStrategicMerge will use the strategic merge patch in kubernetes APIs which means it will use the Patch Method and following the REST architecture model.

You can find the full Strategic Merge Patch in the Reference topic.

Another important part is the names of resources inside in the elements to be patched should be the same as the declared in the base folder. Let’s see an example.

The piece of kustomization located in the base folder

kustomization.yaml located in the base folder
The ConfigMap element declared in the production folder

As we can see the name of the ConfigMap object should be the same in the base and environment it is very important.

The last one is the attribute of the image, it is pretty simple. It describes the tag of the docker image that we want to deploy in a production environment.

Awesome, our configuration stuff is ready, let’s see how to apply it!!!

Running with kustomize

Now we are ready to run through the command line.

kustomize build

Kustomize build helps us to see the updated manifests with the desired environment configuration. We are able to run kustomize build in any folder that has the kustomization.yaml file. We will configure the manifests for the production environment.

Let’s check the files that will be updated. Go to the production folder and use the following command line

The output should be the manifests updated for the production environment. But as we can see it is a simple text, there is no file generated.

Applying the manifests

The kustomize build command line updates our manifests with the desired customization, but it produces simple text output. We can use this output and invoke the kubectl tool to apply this customization. Let’s do it right now

This command will apply the generated stuff on the desired namespace.


I’m still learning the kustomize stuff, but the simplicity imposed by the kustomize caught my attention.

Also, it keeps the kubernetes things in a declarative way and helps me a lot to follow the Infra-as-Code concerns.

Finally, as I said I don’t like the billions of brackets that I need in the helm charts