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.
- 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.
What Are The Kubernetes Deployment Stratagies ?
Traditionally, applications used to be deployed on the Physical Servers. However, it was not very efficient as multiple instances of the applications running on the server used to consume a lot of resources. Although Virtual Machines running on the Servers tried to solve the issue, resource allocation and slow boot times were still problems. Due to this, Containerization Technologies like Kubernetes came into the picture.
In this article, we will learn in detail about the deployment strategies in Kubernetes that will help us to understand why it is one of the most popular choices among Software Experts. So, let us start without any delay.