Arian
Arian

Reputation: 575

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 . ./k8s/overlays/prod

Is it possible with the Kustomize plugin build into kubectl?

also same for the kustomize edit add secret with kubectl without doing the cd into directory?

Upvotes: 10

Views: 6134

Answers (2)

yzorg
yzorg

Reputation: 4480

An newer kustomize shipped in kubectl v1.21, which finally unblocks newer kustomize which unblocks OP scenario (per @acid_fuji answer).

kubectl kustomize
v1.21 v4.0.5 bogus column to make versions easier to read
v1.20 v2.0.3

Upvotes: 1

acid_fuji
acid_fuji

Reputation: 6853

Unfortunately this is not possible. The kubectl's built-in kustomize command only supports patching and applying kustomize files.

I recommend using the standalone version of the kustomize since kubectl uses kustomize version 2.0.4, while the newest is already 3.8.8. Using the older version will break some of the functionalities.

There are many requests to support newer version inside kubectl but there are some technical reasons which hold this from being done. You can track the progress here.

Upvotes: 6

Related Questions