Prerequisites
To upgrade Kubernetes in GKE, you must have a Unix or Linux terminal with the following:- gcloud CLI installed.
- Kubectl installed.
Get cluster credentials
-
If you aren’t already signed in with gcloud, run
gcloud init. -
To protect your current configuration file from being overwritten, run
export KUBECONFIG=$(pwd)/kubeconfig. -
Get the remote
kubeconfig:
Disable the disruption budgets
You must temporarily disable thePodDisruptionBudget (PDB) for certain services. To do this, back up the PDBs, delete the original PDBs, then update Kubernetes and restore the PDBs from the backup after the update is complete.
-
Back up the PDBs:
-
Delete the PDBs:
Determine the upgrade version
-
Get the available GKE versions:
-
Get the current master version:
You can only upgrade by one minor version at a time. For example, if you are on Kubernetes version 1.22, you can upgrade to version 1.23.
Update the cluster
-
Upgrade the control plane. This might take several minutes to complete. Monitor the GCP console for the status of the cluster upgrade.
-
Upgrade the node pools: