Knoldus blog audio

Reading time: 3 minutes

Kubernetes provides deployment resources that tell Kubernetes the ideal state of the application. Deployments are declarative, which means what they have to achieve rather than how. To achieve this desired state, ReplicaSets is deployed under the hood, which further maintains the required set of Pods.

Updates in deployment

Using deployment, we can achieve the ideal state of the application in a K8s cluster, but what if we have to update the version of the application? In this case, the deployment of K8s helps to update the application. If it’s not deployed, we have to manually update the application by creating a new version of POD and removing the old version, and then check that everything is working as expected. Deployment automates the process by simply updating the POD template for the required state and then handing it over to K8s, which will do all the necessary actions in the background to meet the new required state. If you want to go back to the previous configuration, you can easily go back to the state required for the previous deployment.

Deployment strategy

K8s deployments have different types of policies to update the deployment. Each strategy has a different approach to how to achieve the new ideal state.

  • Scroll to update
  • To recreate the
  • The canary
  • Blue/green

Scroll to update

The rolling update policy is the default policy used by Kubernetes. In this deployment strategy, when the POD is up and running, a POD with the new version is created, and then the connection of the old version pod is pointed to the new version, gradually replacing all the old version Pods and updating the deployment.

advantages

  • The implementation of a simple
  • There is no downtime between releases
  • Easy to push/roll back
  • Facilitates stateful applications and can handle data rebalancing

disadvantages

  • Rolling/rolling back takes time
  • There is no control over the flow

To recreate the

Recreating the policy is an all – or – nothing process. All previous versions of the pod are deleted and the new version of the pod is recreated.

advantages

  • Easy to implement.
  • The application status is fully updated.

disadvantages

  • There is a downtime, depending on when the application is shut down and started.

The canary

A Canary deployment is a deployment strategy that increments the application or service to a subset of users. Compared to all other deployment strategies, The Canary release is the least risky because of this control.

advantages

  • Release a version for a subset of users
  • Facilitates error rate and performance monitoring
  • Rapid rollback

disadvantages

  • Slow expansion
  • Fine-tuning the flow distribution can be expensive (99%A/1%B=99 pod A, 1 pod B) and may require the use of additional tools such as Istio and Linkerd.

Blue/green

A blue-green deployment is a deployment strategy that utilizes two identical environments, one “blue” (also known as transit) and one “green” (also known as production), with different versions of the application or service. Both are deployed at the same time, and after testing the newer version, the K8s service, which acts as a load balancer, is updated to send traffic to the newer version.

advantages

  • Immediately roll out/rollback
  • To avoid version problems, change the status of the entire cluster at one time.

disadvantages

  • Double the resources
  • The entire platform should be properly tested before release to production
  • Dealing with stateful applications can be difficult

To summarize

There are different ways to deploy an application, and when publishing to a development/staging environment, recreating or rolling update deployments is often a good choice. When it comes to production and no downtime, choosing rolling updates or blue/green is a good choice. Canary is a good choice if stability is not guaranteed and could affect the release. In this way, consumers will test the application themselves. It depends on how we want to use the deployment and what we want it to look like.

The resources

  • CNCF-Presentation-Template-K8s-Deployment.pdf
  • Learn more about Kubernetes deployment strategy (educative.io)
  • Kubernetes Deployment Strategy (container-solutions.com)
  • This section describes deployment policies. Blue Green, Canary and more | Harness

Sharing site.

  • sing

  • WhatsApp

  • The telegraph

  • More and more

  • E-mail

  • print

The relevant information