Updating and Rolling Back Applications in AKS Tutorial


Updating and rolling back applications is a critical aspect of managing your workloads in Azure Kubernetes Service (AKS). It allows you to introduce new features, apply bug fixes, and respond to changing requirements while ensuring minimal downtime. In this tutorial, you will learn how to update your AKS applications and perform rollback operations when needed.

Updating Applications

To update an application in AKS, you can follow these steps:

  1. Make the necessary changes to your application code or configuration.
  2. Build a new container image with the updates.
  3. Push the new container image to a container registry, such as Azure Container Registry (ACR).
  4. Update the deployment manifest to use the new container image.
  5. Apply the updated deployment manifest using the following command: kubectl apply -f deployment.yaml
  6. Verify that the new version of the application is running as expected: kubectl get pods

Rolling Back Applications

In case of issues or failures, rolling back an application to a previous version can help restore the desired state. Here's how you can perform a rollback:

  1. Identify the previous version of the application that you want to roll back to.
  2. Update the deployment manifest to use the previous version's container image.
  3. Apply the updated deployment manifest using the following command: kubectl apply -f deployment.yaml
  4. Verify that the rollback was successful and the previous version is running correctly: kubectl get pods

Common Mistakes to Avoid

  • Forgetting to build and push the updated container image to the registry before applying the deployment manifest.
  • Not thoroughly testing the new version of the application before updating in the production environment.
  • Missing backup or versioning mechanisms to easily roll back in case of issues.

Frequently Asked Questions (FAQs)

  1. Can I roll back to a specific version using kubectl?

    No, kubectl doesn't provide a direct rollback feature. Instead, you need to update the deployment manifest with the desired version and reapply it.

  2. Is it possible to automate application updates in AKS?

    Yes, you can use continuous integration and deployment (CI/CD) pipelines along with tools like Azure DevOps or Jenkins to automate the update process.

  3. What happens to the pods during an update or rollback?

    AKS performs rolling updates by creating new pods with the updated version and gradually terminating the old pods. This ensures that the application remains available during the process.

  4. Can I monitor the progress of an application update in AKS?

    Yes, you can use kubectl commands to monitor the status of the pods and deployments to track the progress of an update.

  5. Should I back up my application data before performing updates or rollbacks?

    It's always recommended to have backups of critical application data before making any changes or performing rollbacks to mitigate potential data loss.


Updating and rolling back applications in Azure Kubernetes Service (AKS) is crucial for maintaining the desired state of your workloads. By following the steps to update your applications and having a rollback strategy in place, you can confidently introduce changes and respond to issues. Remember to avoid common mistakes such as missing image pushes, inadequate testing, and lack of backup mechanisms. With proper management of application updates and rollbacks, you can ensure the stability and availability of your applications in AKS.