Mutating a Kubernetes deployment yaml for tolerations doc is missing
I don't see the whole file, therefore I cannot correct it.But the problem is with your path, you are probably linking an array -- you have to specify an index. When you want to add an element to the end of an array, use -1
like this: spec/template/spec/containers/0/env/-1
Have a look at this example
- shortened yaml file:
...spec: template: spec: containers: # this is an array, there is 0 in the path - name: somename image: someimage env: # another array, we are putting the element at the end, therefore index is -1 - name: SOME_VALUE_0 value: "foo" - name: SOME_VALUE_1 value: "bar" # I want to add second env variable SOME_VALUE_2 here...
kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1kind: Kustomizationresources: - ../link/to/your/yamlpatchesJson6902: - target: ... patch: |- - op: "add" path: "/spec/jobTemplate/spec/template/spec/containers/0/env/-1" value: {name: "SOME_VALUE_2", value: "baz"}