Azure devops build push image to aks

7/6/2019

I am trying to configure release pipeline in Azure Devops to push image to registry. In the release pipeline I have two tasks run service and expose deployment. When there is no service and deployment in AKS or on first code checkin it works fine but on next checkin it fails service already exist. Any idea where am i doing wrong ?

-- bilal_khan
azure
azure-aks
azure-devops
azure-kubernetes
kubernetes

1 Answer

7/6/2019

you need to be using yaml files and kubectl apply. what you are doing is an imperative way of managing resource and kubectl apply would give you a declarative way of doing that, so it would only apply changes. But given that you only need to update the image, it will probably make more sense to do kubectl set image deployment/nginx-deployment nginx=nginx:1.9.1 , so use kubectl set image to update the image on the existing deployment. another option would be to use something like flux to manage images

-- 4c74356b41
Source: StackOverflow