'How could I run kubectl -k in an Azure DevOps pipeline?

Currently the Azure kubectl task uses Kubectl version 1.13.xxx. Is there any way to run a newer version of kubectl that supports apply -k or kustomize?



Solution 1:[1]

Is there any way to run a newer version of kubectl that supports apply -k or kustomize?

You could define the kubectl version in kbectl task -> Advanced tab.

enter image description here

The default value is 1.13.2, you could change it to the required version.

Solution 2:[2]

I'm not sure if this was an option when the question was originally asked, but for anyone stumbling across this question now Azure DevOps has a special "bake" task for applying kustomize templating

https://docs.microsoft.com/en-us/azure/devops/pipelines/ecosystems/kubernetes/bake?view=azure-devops#kustomize-example

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kevin Lu-MSFT
Solution 2 Sharebear