Kustomize is the standard build tool for Kubernetes manifest aggregation and patching.
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
cd
to a directory with kustomization.yaml
, then run:
kustomize build
If your kustomization.yaml
include the helmCharts operator you must specify the --enable-helm
switch:
kustomize build --enable-helm
Compare changes to currently loaded manifests in the cluster:
kustomize build --enable-helm | kubectl diff -f -
Apply the yaml manifests:
kustomize build --enable-helm | kubectl apply -f -
Newer versions of kubectl
have kustomize built-in, just specify -k
to activate
eg.
kubectl diff -k .
but this is weaker than using standalone kustomize
but kubectl
doesn't use the --enable-helm
switch so fails on
Kustomizations which pull in Helm charts:
error: accumulating resources: accumulation err='accumulating resources from '../base': '/Users/hari/github/k8s/jenkins/base' must resolve to a file': recursed accumulation of path '/Users/hari/github/k8s/jenkins/base': trouble configuring builtin HelmChartInflationGenerator with config: `
includeCRDs: true
name: jenkins
namespace: jenkins
releaseName: jenkins
repo: https://charts.jenkins.io
valuesFile: values.yaml
version: 4.12.1
`: must specify --enable-helm
Once you have this working, you should be getting your ArgoCD to automatically apply your Kustomize + Helm manifests.
This makes Helm becomes fully self-healing GitOps.
HariSekhon/Kubernetes-configs - kustomization.yaml
HariSekhon/Kubernetes-configs repo.
Partial port from private Knowledge Base page 2020+