Shoot K8S version management
Downgrading
Currently not supported.
What to do if lower version is needed?
Deploy new shoot with one of lower version which are supported by us.
What to do, if upgrade is needed and we want to test it?
- Deploy another
test shoot
, with same version of K8S as you have on the shoot cluster you want to upgrade. - Deploy applications you want/need to test on newer version
to shoot cluster from step
1.
- Upgrade shoot cluster from step
1.
to desired K8S version. - Delete shoot cluster from step 1.
- Upgrade your existing cluster.
Upgrading
Before upgrading
Check if Sconified services, especially CAS is running in your cluster. If yes, follow the steps described in Upgrade K8s on Shoot Cluster with running CAS
Check supported K8S versions via kubectl
directly on garden cluster
or in the Gardener Dashboard (described later).
How to check directly on Garden cluster via kubectl
Execute following command:
kubectl get cloudprofiles.core.gardener.cloud onmetal -o=custom-columns='SUPPORTED K8S VERSIONS:.spec.kubernetes.versions[*].version' | sed s/,/\\n/g
example output of previous command:
SUPPORTED K8S VERSIONS
…some lines omitted…
1.28.10
1.28.11
1.28.14
1.28.15
1.29.9
1.29.12
1.30.8
1.31.4
Use grep to search for specific version, as on example below:
$ kubectl get cloudprofiles.core.gardener.cloud onmetal
-o=custom-columns='SUPPORTED K8S VERSIONS:.spec.kubernetes.versions[*].version'
| sed s/,/\\n/g | grep 1.25.9
# output after executing the command should be `1.25.9`
To upgrade K8S version, you can safely do it through gardener-dashboard
or by updating shoot yaml
in the project namespace on garden cluster
.
Through Gardener-Dashboard
Open Gardener-dashboard
In the list of shoot cluster find the cluster you want to upgrade. Then as you can see on picture below follow these steps:
-
Click on the current K8S version of shoot cluster in VERSION column.
-
In pop-up window click on
Upgrade to version
. -
From drop-down menu
Upgrade to version
choose accordingly from available upgrade options based on your desired K8S version.There is possibility, that you will need to upgrade more times, for example if shoot K8S version is 1.23.x and we want to upgrade to 1.26.x we would see in drop-down menu something like this, and we would need to upgrade first to 1.24.x, then 1.25.x and then 1.26.x:
- 1.23.x → 1.24.x
- 1.24.x → 1.25.x
- 1.25.x → 1.26.x
-
Then write or copy/paste shoot name for confirmation in the bottom-left field.
-
Click
UPDATE
button to trigger the update which should be completed within some minutes.
Through Shoot Manifest
This can be done in gardener-dashboard
and via kubectl
directly on the garden cluster.
In Gardener Dashboard
Let's take a look on how to do it through dashboard.
-
Click on shoot name in the list as shown on picture below.
-
Click on YAML
-
Search for version and re-write it to your desired version as shown on picture below:
On Garden Cluster using Kubectl
-
List shoot clusters by using
kubectl get shoots.core.gardener.cloud -A
as on Example.Example:
$ kubectl get shoots.core.gardener.cloud -A NAMESPACE NAME CLOUDPROFILE PROVIDER REGION K8S VERSION HIBERNATION LAST OPERATION STATUS AGE garden-dev shmr20-t00 onmetal onmetal mdb 1.26.2 Awake Reconcile Succeeded (100%) unhealthy 2d23h garden-dev shmr20-t01 onmetal onmetal mdb 1.26.2 Awake Reconcile Processing (88%) unknown 6h31m garden-dev shmr20-t02 onmetal onmetal mdb 1.26.2 Awake Reconcile Processing (82%) unhealthy 5h55m
-
Edit the same field
version:
in the shoot manifest. To do it we can use following command:kubectl edit shoots.core.gardener.cloud <your-shoot-cluster-name> -n <your-shoot-cluster-namespace-from-previous-command>
-
Save by
:wq!
and wait for reconciliation to finish.We could do it locally by getting yaml from the cluster executing:
kubectl get shoots.core.gardener.cloud <your-shoot-cluster-name> -n <your-shoot-cluster-namespace-from-previous-command> -o yaml > <your-shoot-cluster-name>.yaml
then edit and save the manifest and apply it on the cluster using:
kubectl apply -f <your-shoot-cluster-name>.yaml
Upgrade K8s on Shoot Cluster with running CAS
-
Check Shoot Cluster number of worker nodes, please see how to check maximum number of nodes. The Shoot Cluster must have
decreased-number-of-nodes < current-number-of-worker-nodes-max
of worker nodes. If Shoot Cluster has maximum number of nodes, then decrease it todecreased- number-of-nodes - 4 < current-number-of-worker-nodes-max
, please see worker. -
After that create additional worker pool with 3 nodes in each Availability Zone with following snippet
- name: tmp-wrk-pool
kubernetes:
version: 1.XX.xx
minimum: 3
maximum: 3
maxSurge: 1
machine:
type: <machineclass-you-want-to-use>
image:
name: gardenlinux
version: 1061.0.20
architecture: amd64
zones:
- AZ1
- AZ2
- AZ3
cri:
name: containerd
volume:
type: fast
size: 50Gi
and then copy and paste it on .spec.provider.workers
:
spec:
provider:
workers:
…
# Paste tmp-wrk-pool under your actual worker pool
This snippet can be added through Gardener Dashboard
or directly on Garden Cluster
into Shoot Cluster YAML manifest,
please see 08-Shoot-worker-pool-management.
When you save the snippet configuration, wait for reconciliation to finish and then
check if worker nodes from temporary worker pool were created and joined the cluster.
Check status of CAS CR, wait for the migration to finish.
When CAS CR show status HEALTHY
migrate CAS to other worker pool nodes.
CAS CR status must be healthy before proceeding.
To continue, you must follow these steps:
-
Cordon the nodes from
current-wrk-pool
you can do it by executingkubectl get no -o name --no-headers | grep `current-wrk-pool` | xargs -I {} kubectl cordon {}
-
Delete
pod/cas-0
, then wait for it to schedule on one oftmp-wrk-pool
nodes. - Delete
pod/cas-backup-controller-*
, then wait for it to schedule on one oftmp-wrk-pool
nodes. -
Uncordon the nodes from
current-wrk-pool
you can do it by executing:kubectl get no -o name --no-headers | grep `current-wrk-pool` | xargs -I {} kubectl uncordon {}
-
Monitor CAS CR status and wait until migration is finished and status is
HEALTHY
. - Proceed with update of Shoot Cluster by following the steps 08-Shoot-k8s-version-management.
- Wait for upgrade to finish and CAS CR status is
HEALTHY
. - Migrate CAS from
tmp-wrk-pool
to now upgradedcurrent-worker-pool
by following steps from2.
. - Delete
tmp-wrk-pool
. Upgrade with CAS is finished.
Now, you can scale up yourcurrent-worker-pool
back to number of worker nodes you had before starting upgrade process.