Keeping a cluster current and recoverable: upgrades and backups

ExplainedKubernetesDevOps, Hands OnBy Cloud Hands On

How Kubernetes versions move, how to upgrade without outages, and what to back up when you can't back up etcd.

Kubernetes ships a new minor version about three times a year and supports each for around a year. Clusters that fall behind stop getting security fixes, so upgrades are routine maintenance, not projects. Go one minor version at a time, control plane first, then nodes.

Before each upgrade, look for removed APIs in your manifests and charts, read the release notes, and upgrade a test cluster first. During the upgrade, nodes are drained one at a time, so apps need more than one replica and disruption budgets that allow a pod to move.

For recovery, separate cluster state from app data. On self-managed clusters, etcd snapshots capture all objects. On managed clusters you can't restore etcd, so keep manifests in Git (GitOps can rebuild everything) and back up objects and volumes with a tool such as Velero or AKS Backup. Databases also need their own backups. Test restores, or you don't really have backups.

Cost. Free to learn on kind. In a cloud, surge nodes during upgrades and backup storage are charged.

Use it when

How it works

Release cadence
About three minor versions a year, each supported for around a year.
Order
Test cluster, control plane, then node pools, one minor version at a time.
API checks
Find removed API versions before they break deploys.
State
etcd snapshots on self-managed clusters; Git and backup tools on managed ones.
Data
Volume snapshots and database-native backups, tested by restoring.

Options

In-place node upgrade
Upgrade each node in turn; cheaper, slower.
Surge or blue-green node pools
Add new nodes, move pods, remove old ones; safer, costs more for a while.
Rebuild from Git
A new cluster from your manifests, then switch traffic.

Example. Fernhill Cloud upgrades AKS every quarter: a removed-API scan in the pipeline, test cluster the first week, production node pools on two evenings, and a quarterly restore test of one namespace from AKS Backup.

Don't confuse it with

Auto-upgrade channels
AKS can upgrade for you on a schedule; you still need the API checks and disruption budgets.
Backing up only Git
Rebuilds objects but not data in volumes or databases.

Words to know

Drain
Move all pods off a node so it can be maintained.
Disruption budget
How many pods of an app may be down at once during voluntary changes.
Velero
An open-source tool for backing up Kubernetes objects and volumes.

Where to look

  1. kubectl version
  2. Release notes
  3. Backup tool

Practise it

Read it in the guide, next to the tasks and labs.

Open in DevOps, Hands On

Keep going