Rolling update – Kubernetes

Vanakkam all

This writing is about Rolling update commands in Kubernetes and the drawbacks to be evaluated before using this deployment strategy

Kubernetes :

Rolling update is one of the deployment strategy being used in Kubernetes where you need to update your application to a new version without causing downtime. Without causing downtime is the key to business users.

Rolling update scenarios :

  • Zero downtime application deployments
  • Software updates
  • Configuration changes – environment variables, resource limits
  • Scaling changes – replicas, resource allocations

Rolling update implementation:

Can be implemented either through‘kubectl’ command line or YAML file

Application deployment :

Before performing rolling update, lets create a deployment

kubectl create deployment mydeployment --image=nginx:1.15 --replicas=2
kubectl get deployment
kubectl get pods

Option 1– Update the application using YAML file method :

vi mydeployment.yaml 

apiVersion: apps/v1
kind: Deployment
metadata:
  name: mydeployment
spec:
  replicas: 2
  selector:
    matchLabels:
      app: mydeployment
  template:
    metadata:
      labels:
        app: mydeployment
    spec:
      containers:
      - name: nginx-container
        image: nginx:1.16
kubectl apply -f mydeployment.yaml

Option 2 – Update application using ‘kubectl’ CLI

kubectl get deployment
kubectl set image --help
kubectl set image deployment/mydeployment nginx-container=docker.io/nginx:1.16

Monitoring the Rolling update :

kubectl rollout status deployment/mydeployment

Practical Drawbacks:

Rolling update is one of the awesome feature in Kubernetes, as we can update applications without causing downtime. At the same time, one must be mindful of the situation, environment while we use rolling update deployment strategy option, as this has drawbacks too

  • Increased deployment time

Larger deployments take more time to completed compared to bluegreen deployment strategy

  • Increased resource Consumption

During rolling update, old and new version to be maintained at one stage and during that time, the resource consumption will be high.

  • Stateful application

Rolling updates may not guarantee zero downtime

  • Dependencies

Incase if your application has dependencies, choosing rolling update should have proper considerations

  • Incompatibility issues

In some cases, rolling update might expose incompatibility issues between older and newer version