I want run to a few commands like kubectl create namespace. However, the second time they run, they fail with an exit code of 1:
> Error from server (AlreadyExists): namespaces "foo" already exists
I have enabled 'Continue on error' however, this still results in the Azure Pipelines release showing yellow warnings, suggesting that there were propblems with the release. Is there a way to stop the warnings? The only way I can think of to do this is to write yaml files and use kubectl apply on them.
As an aside, is it possibly to provide this task with a bash file containing several kubectl commands?
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
I'm missing this feature too. Also it would be great if secrets had option for TLS and not just container registry and generic.
I would like secrets to also support TLS option in addition to already supported ACR and generic. This is could be a way to add TLS certificates (from Azure Keyvault for example) from Azure DevOps as a kubernetes TLS secret. So one could run "kubectl get secrets my-secret" and create / update TLS secret.
@RehanSaeed Unfortunately the current K8s deploy task is a wrapper on top of kubectl and the behavior you describe is the default kubectl. We are working on a couple of features and that will solve the issue you have. Will you be interested in giving us some early feedback by using/reviewing them?
@JonnewDev Thanks for the feedback. I have added it to the backlog and we will get it done.
https://kubernetes.github.io/ingress-nginx/user-guide/tls/
We are working on a couple of K8s features. Will you be interested in giving us some early feedback by using/reviewing them?
I was trying to create namespaces and roles for Tiller as part of a Helm installation. I've since moved to using Helm to generate my yaml and running that directly without the use of Tiller at all. With that said @azooinmyluggage what is the solution you are testing?
Same issue here.
I managed to use kubectl apply with an inline configuration file:
apiVersion: v1
kind: Namespace
metadata:
name: $(KubernetesNamespace)
This doesn't error if the namespace already exists.
@RehanSaeed How do you supply an inline config? I don't see any mention of that on the Kubectl task page (apart from a comment at the bottom asking for more details!)
@howardjones just check "Use configuration"

How about in the Pipeline YAML file?
How about in the Pipeline YAML file?
useConfigurationFile: true
configurationType: inline
inline: |
apiVersion: v1
kind: Namespace
metadata:
name: $(KubernetesNamespace)
Interesting. Neither inline or configurationType are mentioned on https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/kubernetes?view=azure-devops
Interesting. Neither
inlineorconfigurationTypeare mentioned on https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/kubernetes?view=azure-devops
Interesting indeed. I used the visual pipeline editor like @lgmorand suggested and generated yaml from there. Works for me 👍
Most helpful comment
I managed to use
kubectl applywith an inline configuration file:This doesn't error if the namespace already exists.