Search code examples
kuberneteskubernetes-helmazure-akskubernetes-service

Avoid recreation of Kubernetes cluster when upgrading web api


Maybe I am missing something but am I right in thinking that if I want to update a webapi that is hosted in my kubernetes cluster in Azure I have to delete and recreate it?

The instructions I am seeing online seem to show deleting the cluster rather than upgrading the api

Paul


Solution

  • If it's your web API application then it's only deployment image update, you don't need to delete the whole cluster.


    There is an example of updating a nginx deployment with new image:

    kubectl set image deployment/nginx-deployment nginx=nginx:1.16.1 --record
    

    This way it will first create a new pods with newer version of image and once successfully deployed it will terminate old pods.

    You can check status of the update by running

    kubectl rollout status deployment.v1.apps/nginx-deployment
    

    Additional resources: