Skip to content

Using kustomize

kustomize is a manifest customization tool built into kubectl. It allows performing template-free, structured customizations of Kubernetes manifests through generators and transformers defined in kustomization files.

The example below demonstrates how to use kustomize to automatically add custom labels to all objects that compose a Bridge at deployment time, without touching the original List-manifest.

Project Structure

Consider the project structure below, where:

  • my-bridge-manifest.json is a Bridge List-manifest generated by til generate.
  • kustomization.yaml is a kustomization file describing the desired transformations to perform on Kubernetes objects which compose the Bridge.
├── kustomization.yaml
└── my-bridge-manifest.json

In the kustomization file, we define:

  • The labels to be injected under a commonLabels field (in this case, an ID and a revision).
  • The resources these transformations apply to under a resources field (the generated Bridge List-manifest).
kind: Kustomization

commonLabels: my-bridge "1"

- my-bridge-manifest.json


The resulting Kubernetes manifests can either be generated to standard output using the command:

$ kubectl kustomize project/
apiVersion: example/v1
kind: SomeKind
  labels: my-bridge "1"
  name: some-name

Or they can be deployed directly to the destination cluster using the command:

$ kubectl create -k project/
somekind.example/some-name created
otherkind.example/other-name created


To undo the deployment of a Bridge, simply delete its Kubernetes objects:

$ kubectl delete -k project/
somekind.example/some-name deleted
otherkind.example/other-name deleted

Important Considerations

Please note that using kustomize for deploying complex applications, including TriggerMesh Bridges, has the same limitations as the ones described in the kubectl page.