Kubernetes Deployment Strategies
- In the old days, we typically use to upgrade applications by just shutting down the older application and installing the newer application, and restarting the server.
- This is the biggest challenge is to speed up the deployment speed.
- Kubernetes provides an advanced platform for making cloud-native deployments easy.
Here, we will discuss various different strategies to upgrade applications from the older version to newer version capabilities.
- Recreate deployment strategy will terminate all the running pod instances and then recreate them with the newer version.
- It is also called dummy deployment.
- This technique implies downtime of the application that depends on both the shutdown and boot duration of the application.
- When it comes to easy setup, Recreate is a good option.
- Application state entirely renewed.
- High impact on the user, expect downtime that depends on both shutdown and boot duration of the application.
2. Rolling Update
- This deployment strategy is the default strategy in Kubernetes.
- In this, pods of the previous version are slowly replaced one by one pod of the new version without any cluster downtime.
- Also, this is one of the best deployment strategies in Kubernetes.
- For example, let’s imagine an application with four pods.
- When the developers start to upgrade to the newer version, pods are upgraded one at a time until all pod instances are replaced with the newer applications.
- Slow-release of version across instances.
- Useful for stateful applications that can handle the data.
- In this strategy, rollout and rollback take time.
- There is no control over the traffic.
- In this Kubernetes deployment strategy, traffic is split based on weight.
- A canary deployment consists of slowly moving production traffic from version A to version B.
- This is an ideal deployment strategy for someone who wants to test the newer version before it is 100 percent deployed.
- In the above example, First, you may upgrade from version1 to version2 and do then do some testing, If the test results are good, then you can upgrade the remaining three pod instances.
- In this strategy, rollback is fast.
- Convenient for monitoring application performance and error rates.
- The rollout is slow in this strategy.
- Using this deployment strategy, we deploy the same number of the newer versions of the app along with the older version of the instance.
- Then switch the user traffic from older to newer instances, if there are any issues with the newer version, it is very easy to switch back to the older version.
- We can remove the older version when your newer one is working fine.
- rollout and rollback are fast.
- Versioning issues are fixed as a whole application state is changed completely.
- The cost factor, as this strategy requires double the resources.
- Required proper testing of application before deploying it to production.