Search⌘ K

Performing a Rolling Update

Explore how to perform rolling updates in Kubernetes deployments by updating Pod images gradually to maintain application availability. Understand rollout strategies, update settings, and how to pause, resume, and monitor deployment progress for smooth zero-downtime updates.

Introduction to rolling updates

As stated previously, scaling operations are almost instantaneous. This is not the case with rolling updates. Rolling updates gradually replaces old instances with new ones, ensuring that some versions of the application remain available at all times.

Let’s perform a rolling update.

Note: The terms rollout, release, zero-downtime update, and rolling update mean the same thing, and we’ll use them interchangeably.

The new version of the app has already been created, tested, and uploaded to Docker Hub with the nigelpoulton/k8sbook:2.0 tag. All that’s left is for us to perform the rollout. We’re ignoring real-world CI/CD workflows and version control tools to simplify the process and keep the focus on Kubernetes.

Before continuing, it’s vital we understand that all update operations are actually replacement operations. When we update a Pod, we’re actually deleting it and replacing it with a new one. Pods are immutable objects, so we never change or update them after they’re deployed.

The first step is to update the image version in the deploy.yml file. Let's update the image version to nigelpoulton/k8sbook:2.0. The following trimmed output shows which line in the file to update.

YAML
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-deploy
spec:
replicas: 10
<Snip>
template:
<Snip>
spec:
containers:
- name: hello-pod
image: nigelpoulton/k8sbook:2.0 <<==== Update this line to 2.0
ports:
- containerPort: 8080
...