How do I actually get the output of kubectl kustomize into my cluster?

3/28/2021

I have a very simple kustomization.yaml:

configMapGenerator:
  - name: icecast-conifg
    files:
      - icecast.xml

When I run kubectl kustomize . it spits out a generated configMap properly, but how do I actually load it into my cluster? I'm missing some fundamental step.

-- user3056541
k3s
kubectl
kubernetes
kustomize

2 Answers

3/28/2021

You could do for example

kubectl kustomize . | kubectl apply -f -
-- Henry
Source: StackOverflow

3/28/2021

With Kustomize you can use the -k (or --kustomize) flag instead of -f when using kubectl apply. Example:

kubectl apply -k <my-folder-or-file>

See Declarative Management of Kubernetes Objects Using Kustomize

-- Jonas
Source: StackOverflow