MicroK8S upgrade/downgrade

While we had and issue with network, also decided to upgrade the cluster, here what was done

Обновление ноды mks3

On mks1 run:

microk8s kubectl drain mks3 --ignore-daemonsets --delete-local-data

Notes:

  • this command marks node as unavailable and move everything from it to other nodes
  • took ~ 5min
  • after completion, there should be no pods on mks3, check it by running microk8s kubectl get po -A -o wide

On mks3:

sudo snap refresh microk8s --channel=1.19/stable

Notes:

  • it is note recommended to jump upgrade skipping versions
  • while upgrading, services will be restarted
  • after completion microk8s.kubectl get no should show new version

On mks1:

microk8s kubectl uncordon mks3

Notes:

  • command "unfreezes" note
  • after it, deployments will start to move back to mks3

Next, do the same on mks2 and mks1

On mks1 got an issue Can't connect to HTTPS URL because the SSL module is not available. Found few articles in internet, especially this. So did update, skipping all versions.

After that did update mks2 and mks3 to actual at the time 1.21 version.

Original docs.

Downgrade

Because in prod we had 1.18 and locally 1.21 cronjobs become broken, so were forced to rollback

On mks1:

microk8s kubectl drain mks3 --ignore-daemonsets --delete-local-data

On mks3:

sudo snap refresh microk8s --channel=1.18/stable

On mks1:

microk8s kubectl uncordon mks3

At the end microk8s kubectl get nodes should upgrade and show nodes with desired verion

Did that in such order: mks3, mks2, mks1

Also, restart of all deployments were need

kubectl -n dev rollout restart deployment
kubectl -n dev get po | grep -v Running