kustomize: `kubectl apply -k` vs `kustomize build` "env" and "envs" error
Hi,
I’m trying to simplify the structures of my yaml files. I segregated the common configs and secrets so I can re-use it into my deployment manifests.
I used:
# sample file.yaml
configMapGenerator:
name: my-config
envs: #env
- config.env
Then I ran:
$ kubectl apply -k .
error: AccumulateTarget: couldn't make target for path/to/config/folder: json: unknown field "envs"
couldn't make target for path/to/config/folder: json: unknown field "envs"
AccumulateTarget: couldn't make target for base: json: unknown field "envs"
After changing it from envs to env then ran:
$ kustomize build .
Error: accumulating resources: recursed accumulation of path 'path/to/configs/folder': accumulating resources: couldn't make target for path 'path/to/configs/folder/subfolder': json: unknown field "env"
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 21
- Comments: 20 (5 by maintainers)
So, what is the proposed solution here? I just ran into this issue as well and didn’t realize until I created #2378.
kubectl apply -kto useenvsinstead ofenvorkustomize buildto useenvinstead ofenvsorenvandenvsI think it makes sense to fix
kubectl apply -kto useenvsbut then this issue now belongs to kubectl?To the maintainers…
I really don’t know what the desired state is, but kubectl and kustomize differ:
Can we easily see which kustomize module is part of kubectl?
Why don’t we finalize v1 of the kustomize spec (still v1beta1) if we are already advertising the use of kustomize in normal Kubernetes kubectl operations?
I can find this: https://github.com/kubernetes/kubectl/blob/master/go.mod#L46 which shows that kubectl is still using 2.0.3 of kustomize. Seems very old!
It’s interesting that kustomize v3.0.0 and v3.5.4 seem to autocorrect the
envtoenvs, why doesn’t later versions have it?The latest kustomize version that understands “env” in configMapGenerator is 3.2.3
I’m just gonna revert my kustomize version and pretend this never happened.
Still an issue. Looks like ppl keep creating issue after issue but the issue never gets addressed.
Please take a look at this issue for the reason that latest kustomize cannot be shipped with kubectl.
I didn’t rely on kubectl anymore to have a fix the differences. I just run ‘kustomize build . | kubectl apply -f -‘ whenever I want to deploy.
On Sat, 28 Mar 2020 at 21:57, Marián Hlaváč notifications@github.com wrote:
Seems like this may be a backwards compatibility issue with the 2 version of kubectl