Open In App

Kubernetes Deployment Stratagies

Last Updated : 11 Sep, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

Deployment strategies in Kubernetes help update applications safely while minimizing downtime and reducing risk.
By using deployment strategies, teams can ensure smooth updates, reduce production errors, and improve overall application reliability.

Deployment Strategies In Kubernetes

There are different approaches through which we can manage our containerized applications. These different deployment strategies allow us to roll out the updates to the applications with minimal downtime. The following are the some of the popularly known kubernetes Deployment Strategies:

  1. Recreate Deployment Strategy
  2. Rolling Update Deployment Strategy
  3. Blue Green Deployment Strategy
  4. Canary Deployment Strategy
  5. A/B Testing Deployment Strategy
  6. Shadow Deployment Strategy

Recreate Deployment Strategy

In Kubernetes, the Recreate Deployment Strategy is one of the simplest approaches to updating applications. This strategy down all existing pods of the previous version of the application and then creates new pods for the updated version. In other words, it terminates all running instances of the old version and replaces them with instances of the new version.

Recreate Deployment Strategy
  • The following YAML can be used to implement this kind of deployment:
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
spec:
replicas: 3
strategy:
type: Recreate
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-app-container
image: my-image:latest

Use Case Of Recreate Deployment: Recreate deployment is suitable for applications that can tolerate downtime during the deployment process or for scenarios where the application's state can be easily recreated.

Rolling Update Deployment Strategy

The Rolling Update Deployment Strategy is the most commonly used approach for updating applications. This approach gradually replaces the instances of the previous version of the application with instances of the updated version, one at a time. This reduces the downtime and improves the performance.

Rolling-Update Deployment Strategy

  • The following YAML can be used to implement this kind of deployment:
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
spec:
replicas: 3
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-app-container
image: my-image:latest

Use Case For Rolling Update Strategy: Rolling update is ideal for applications that require high availability and cannot afford any downtime during the deployment. Thus, you can use It to switch from the old version to the new version while maintaining uninterrupted service.

Blue-Green Deployment Strategy

The Blue-Green Deployment focuses on running two identical environments, referred to as blue and green. An important point to note is that both these environments run concurrently. The blue environment represents the current production version of the application, while the green environment represents the new version being deployed.

Blue-Green

  • The following YAML can be used to implement this kind of deployment:
apiVersion: v1
kind: Service
metadata:
name: my-app-service
labels:
app: my-app
spec:
ports:
- port: 80
targetPort: 8080
selector:
app: my-app
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app-blue
spec:
replicas: 3
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
color: blue
spec:
containers:
- name: my-app-container
image: my-image:blue
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app-green
spec:
replicas: 0
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
color: green
spec:
containers:
- name: my-app-container
image: my-image:green

Use Case For Blue Green Deployment: This deployment is suitable for applications where zero downtime is important so that we can quickly rollback to the previous version is essential.

Canary Deployment Strategy

This deployment technique in Kubernetes gradually rolls out updates to applications by exposing them to a subset of users or traffic before making them available to the entire user base. Thus, it allows the users to validate the new version's performance, stability, and user experience in a controlled environment before fully deploying it.

Canary-Deployment

  • The following YAML can be used to implement this kind of deployment:
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
spec:
replicas: 3
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-app-container
image: my-image:latest
---
apiVersion: v1
kind: Service
metadata:
name: my-app-service
spec:
ports:
- port: 80
targetPort: 8080
selector:
app: my-app

Use Case For Canary Deployment Strategy: Canary deployment is useful for applications that want to test new features or changes in a real-world environment before making them available to all users. Thus, we can detect the issues early before the the complete deployment.

A/B Testing Deployment Strategy

The A/B Testing Deployment Strategy compares two or more versions of applications by serving different versions to different subsets of users or traffic. This approach allows users to evaluate performance, usability, and effectiveness of different versions and make data-driven decisions about which version to deploy to entire user base. It is also called as Split Testing.

A_B-Testing

  • The following YAML can be used to implement this kind of deployment:
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
spec:
replicas: 3
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-app-container
image: my-image:version-a
---
apiVersion: v1
kind: Service
metadata:
name: my-app-service
spec:
ports:
- port: 80
targetPort: 8080
selector:
app: my-app

Use Case For A/B Deployment: If you have to experiment with different features, designs, or configurations to optimize user engagement or conversion rates, you can implement the A/B deployment in Kubernetes. Thus, it enhances the performance based on the user-feedback.

Shadow Deployment Strategy

Shadow Deployment in Kubernetes tests new versions or changes to an application in a production-like environment without impacting the existing production workload. It involves running parallel deployment of the new version alongside existing production deployment, allowing users to observe and compare behavior and performance of new version without affecting users or disrupting service.

Shadow-Deployment

  • The following YAML can be used to implement this kind of deployment:
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app-shadow
spec:
replicas: 3
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-app-container
image: my-image:latest
---
apiVersion: v1
kind: Service
metadata:
name: my-app-shadow-service
spec:
ports:
- port: 80
targetPort: 8080
selector:
app: my-app

Use Case For Shadow Deployment: Sometimes, we want to validate the behavior and performance of a new version in a real-world scenario before fully deploying it. Hence, Shadow deployment is useful for such cases. It can easily identify differences between the new and existing versions before they impact users.


Explore