Auto deploy on azure kubernates when docker image is updated: possible?

6/24/2019

I have created an application by using azure's kubernates service. In my yaml I specified "latest" as image version for every image I'm using.

Is there any option to make so that, when I update the image registry so that "latest" changes, kubernates auto-deploys that? And everything is managed so that it only updates one replica and then scales so that service is not interrupted during deploy?

-- Phate
azure
azure-aks
azure-kubernetes
kubernetes

3 Answers

6/24/2019

you should really use release management for this or something like gitops that would trigger updates when new version of container is available. using Azure Functions\Automation for this is just not right. Its not meant for that, it would be complicated\unreliable.

-- 4c74356b41
Source: StackOverflow

6/24/2019

Kubernetes is not aware of the changes at your registry, it is not monitoring for new container images. You would need to create a process that is triggered when a new version is released and updates your Kubernetes deployment. You could use CI/CD tools for this, or things like Azure Functions, Azure Automation etc.

For deploying without downtime you would want to look at rolling updates.

-- Sam Cogan
Source: StackOverflow

6/24/2019

Is there any option to make so that, when I update the image registry so that "latest" changes, kubernates auto-deploys that?

It's not kubernetes's work to handle this. There are two steep to work on this:

  • Add webhook on docker registry, for docker-hub, it is Docker Hub Webhooks. When new image has been pushed to registry, you can send a POST request to somewhere as notification.

  • Deploy a CI/CD to receive that notification and roll update your application. Or just create a simple HTTP Server to handle notification request and do something like kubectl ....

And everything is managed so that it only updates one replica and then scales so that service is not interrupted during deploy?

Kubernetes handle this by rolling update. For Deployment or StatefulSet, current kubernetes auto update pods by rolling update, all you need to do is kubectl apply -f new-spec.yaml.

-- menya
Source: StackOverflow