Questions tagged [kustomize]

Questions about using kustomize to create and modify Kubernetes manifests in an immutable way.

Kustomize traverses a Kubernetes manifest to add, remove or update configuration options without forking. It is available both as a standalone binary and as a native feature of kubectl. Kustomize supports taking a base set of Kubernetes manifest and applying overlays that apply patches to generate an environment-specific version of the base manifest. It also included generators for configuration maps and secrets.

362 questions
6
votes
1 answer

kustomize edit set image doesn't work with kustomize multibases and common base

I am using this example: ├── base │   ├── kustomization.yaml │   └── pod.yaml ├── dev │   └── kustomization.yaml ├── kustomization.yaml ├── production │   └── kustomization.yaml └── staging └── kustomization.yaml and in kustomization.yaml file…
Arian
  • 465
  • 1
  • 7
  • 18
6
votes
1 answer

Kustomize - Merge multiple configMapGenerators

So I'm dealing with a structure like this: . ├── 1 │   ├── env-vars │   └── kustomization.yaml ├── 2 │   ├── env-vars │   └── kustomization.yaml ├── env-vars ├── kustomization.yaml └── shared ├── env-vars └── kustomization.yaml while…
Mahyar
  • 1,011
  • 2
  • 17
  • 37
6
votes
2 answers

Can we use k8s kustomize with kubectl to set image and create secret file?

I am using k8s kustomize to set the image and create a secret file $(cd ./k8s/overlays/prod && kustomize edit set image gcr.io/PROJECT_ID/image:1.0) and this works! Now I am trying to use the kubectl kustomize to do the same without doing the cd .…
Arian
  • 465
  • 1
  • 7
  • 18
6
votes
3 answers

kustomize: add imagePullSecrets to all deployments

I have a set of kubernetes config files that work in one environment. I'm looking to deploy into another environment where I need to add an imagePullSecrets entry to all of the Deployment configs. I can do: regcred-1.yaml: apiVersion:…
Job Evers
  • 4,077
  • 5
  • 20
  • 26
5
votes
1 answer

Kustomize - patch every item in a list

I'm trying to use patching in Kustomize to modify Kubernetes resources and I'm wondering if there is a neat way to update every item of a list. Here is the yaml that I'd like to customize: apiVersion: admissionregistration.k8s.io/v1 kind:…
dywan666
  • 385
  • 8
  • 14
5
votes
1 answer

Adding items to a list with kubectl kustomize

I have base/foo.yaml that I want to apply to all my environments and it partially looks like this Kubernetes: deploymentPatches: - patch: |- - {"op": "add", "path": "/spec/template/spec/volumes/-", "value": {"name": "volume", "secret":…
Eirik H
  • 654
  • 2
  • 8
  • 30
5
votes
1 answer

Kustomize overlays when using a shared ConfigMap

I have an environment made of pods that address their target environment based on an environment variable called CONF_ENV that could be test, stage or prod. The application running inside the Pod has the same source code across environments, the…
TPPZ
  • 4,447
  • 10
  • 61
  • 106
5
votes
2 answers

How to share resources/patches with multiple overlays using kustomize?

I have a kube-prometheus deployed to multiple environments using kustomize. kube-prometheus is a base and each environment is an overlay. Let's say I want to deploy dashboards to overlays, which means I need to deploy the same ConfigMaps and the…
RedReaperKun
  • 121
  • 1
  • 9
5
votes
2 answers

Add environment variable to Kubernetes StatefulSet with Kustomize

I have a StatefulSet like this: apiVersion: apps/v1 kind: StatefulSet metadata: namespace: myns name: myapp spec: replicas: 3 template: spec: containers: - name: mycontainer image: ... ... env: …
Salvatore D'angelo
  • 1,019
  • 3
  • 14
  • 39
5
votes
1 answer

Create variable in kustomize manifest

I have what I would consider a common use case but I am really struggling to find a solution: I want to reuse a variable in Kustomize patches in our deployments. Specifically, we are using commit IDs to reference image tags (Use Case A) and k8s…
tech4242
  • 2,348
  • 2
  • 23
  • 33
5
votes
2 answers

How can I replace variables in annotation via Kustomize?

Any ideas how can I replace variables via Kustomize? I simply want to use a different ACCOUNT_ID and IAM_ROLE_NAME for each overlay. apiVersion: v1 kind: ServiceAccount metadata: annotations: eks.amazonaws.com/role-arn:…
cosmos-1905-14
  • 783
  • 2
  • 12
  • 23
5
votes
1 answer

Is it recommended to use kustomize after helm?

Sometimes when I use helm charts, not all things I want to modify are usable with the given values. Is it practical to use kustomize to modify the rendered helm chart? So like this: chart -> helm template -> kustomize -> kubectl deploy
8bit
  • 528
  • 2
  • 6
  • 25
5
votes
1 answer

Replace multiple hosts of gke ingress using kustomize overlays

I have a GKE/GCE ingress file which has 2 hosts. apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: my-ingress spec: rules: - host: myfirstdomain # <-------- override this via kustomize http: paths: - path:…
5
votes
1 answer

How to use a generated env configMap entry as a var in kustomize?

I have a generated config map configMapGenerator: - name: template-vars envs: - templateVars.env and would like to use one of the contained values ROUTE_HOST=somewhere.else.org as a variable vars: - name: ROUTE_HOST objref: …
eventhorizon
  • 2,977
  • 8
  • 33
  • 57
5
votes
2 answers

unable to patch service name using kustomize

I am trying to rename my service using kustomize. I am getting the following error: Error: couldn't find target core_v1_Service|~X|~P|SERVICE_NAME|~S for json patch Here is my Base service file: apiVersion: v1 kind: Service metadata: labels: …
Ram
  • 655
  • 2
  • 7
  • 27
1 2
3
24 25