I often get asked when I talk about Container Engine (GKE):
How are upgrades to Kubernetes handled?
As we spell out in the documentation, upgrades to Kubernetes masters on GKE are handled by us. They get rolled out automatically. However, you can speed that up if you would like to upgrade before the automatic update happens. You can do it via the command line:
gcloud container clusters upgrade CLUSTER_NAME --master
You can also do it via the web interface as illustrated below.
Updating nodes is a different story. Node upgrades can be a little more disruptive, and therefore you should control when they happen.
What do I mean by “disruptive?”
GKE will take down each node of your cluster killing the resident pods. If your pods are managed via a Replication Controller or part of a Replica Set deployment, then they will be rescheduled on other nodes of the cluster, and you shouldn’t see a disruption of the services those pods serve. However if you are running a Pet Set deployment, using a single Replica to serve a stateful service or manually creating your own pods, then you will see a disruption. Basically, if you are being completely “containery” then no problem. If you are trying to run a Pet as a containerized service you can see some downtime if you do not intervene manually to prevent that downtime. You can use a manually configured backup or other type of replica to make that happen. You can also take advantage of node pools to help make that happen. But even if you don’t intervene, as long as anything you need to be persistent is hosted on a persistent disk, you will be fine after the upgrade.
You can perform a node update via the command line:
gcloud container clusters upgrade CLUSTER_NAME [--cluster-version=X.Y.Z]
Or you can use the web interface.
A couple things to consider:
- As stated in the caption above, we recommend you say within 2 minor revs of your master. These recommendations come from the Kubernetes project, and are not unique to GKE.
- Additionally, you should not upgrade the nodes to a version higher than the master. The web UI specifically prevents this. Again, this comes from Kubernetes.
- Nodes don’t automatically update. But the masters eventually do. It’s possible that the masters could automatically update to a version more than 2 minor revs beyond the nodes. This can a cause compatibility issues. So we recommend timely upgrades of your nodes. Minor revs come out at about once every 3 months. Therefore you are looking at this every 6 months or so.
As you can see, it’s pretty straightforward. There are a couple of things to watch out for, so please read the documentation.