Kubectl kustomize: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 12: Line 12:
The "kustomize" logic reads a series of source API resource [[Kubernetes Manifests#Overview|manifests]], instructions from a kustomization.yaml file and generates syntactically valid and complete API resource [[Kubernetes Manifests#Overview|manifests]] at stdout. The generated content may contain multiple resource representations, separated by ---. The output can be further processed by other tools or streamed directly into <tt>kubectl</tt> for deployment to a cluster.
The "kustomize" logic reads a series of source API resource [[Kubernetes Manifests#Overview|manifests]], instructions from a kustomization.yaml file and generates syntactically valid and complete API resource [[Kubernetes Manifests#Overview|manifests]] at stdout. The generated content may contain multiple resource representations, separated by ---. The output can be further processed by other tools or streamed directly into <tt>kubectl</tt> for deployment to a cluster.


  kubectl kustomize <''dirname''> > ''ouptut.yaml''
  kubectl kustomize <''dirname''> > ''output.yaml''


The directory specified as argument must contain <tt>kustomization.yaml</tt>.
The directory specified as argument must contain <tt>kustomization.yaml</tt>.

Revision as of 17:23, 23 August 2019

External

Internal

Overview

The "kustomize" logic reads a series of source API resource manifests, instructions from a kustomization.yaml file and generates syntactically valid and complete API resource manifests at stdout. The generated content may contain multiple resource representations, separated by ---. The output can be further processed by other tools or streamed directly into kubectl for deployment to a cluster.

kubectl kustomize <dirname> > output.yaml

The directory specified as argument must contain kustomization.yaml.

It seems to add prefixes to names, update image tags, adds namespace metadata, "yaml-cleans" according to rules that have yet to be elucidated.

kustomization.yaml Example

namePrefix:
images:
- name: something
  newTag: ...
namespace: ...   
resources:
- manifest-1.yaml
- manifest-2.yaml
patchesStrategicMerge:
- file1.yaml