Chapter 2. Key Strategic Functionality Provided by Kustomize

In Chapter 1, we introduced Kustomize and discussed how it allows us to reuse Kubernetes manifests without incurring changes to the original files. In this chapter we’ll cover more of the whys and hows of leveraging Kustomize as a strategic advantage for reusing Kubernetes manifests. This will help you evaluate Kustomize as a potential fit for your use cases.

Specifically, we’ll look at how and why Kustomize provides the following functionality:

  • Adding common identifiers to a set of resources
  • Easily creating and managing variations of configurations
  • Strategically patching (updating) key areas of manifests
  • Leveraging hierarchical structures with Kustomize
  • Making customizations more configurable through components

We’ll start with how to easily add common transformations against a set of resources, a topic we discussed only briefly in the first chapter.

Common Transformations

A frequent use case when working with reuse or wider use of Kubernetes objects is applying a common identifier across multiple objects. Kubernetes relies on identifiers such as labels and annotations for this. It can use labels and annotations to easily identify and select resources. They can also be used to embed additional information about or into objects.

Kustomize provides a set of simple transformations that it can apply to a set of resources to update them with one or more of these types of identifiers. These transformers include:

commonLabel ...

Get Leveraging Kustomize for Kubernetes Manifests now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.