heathcliff26/kube-upgrade-controller

By heathcliff26

Updated 9 days ago

Github: https://github.com/heathcliff26/kube-upgrade

Image
Integration & delivery
Operating systems
0

6.4K

heathcliff26/kube-upgrade-controller repository overview

CI Coverage Status Editorconfig Check Generate go test cover report Renovate

kube-upgrade

Kubernetes controller and daemon for managing cluster updates.

Table of Contents

Introduction

Usage

Prerequisite
  • A kubernetes cluster installed with kubeadm
  • Nodes using Fedora CoreOS with upgraded already installed (See Links)
Installation

To install kube-upgrade, follow these steps:

  1. Deploy upgrade-controller
kubectl apply -f https://raw.githubusercontent.com/heathcliff26/kube-upgrade/main/examples/upgrade-controller.yaml
  1. Create the upgrade-plan
https://raw.githubusercontent.com/heathcliff26/kube-upgrade/main/examples/upgrade-cr.yaml

Container Images

Image location
Container RegistryImage
Github Containerghcr.io/heathcliff26/kube-upgrade-controller
Docker Hubdocker.io/heathcliff26/kube-upgrade-controller
Quay.ioquay.io/heathcliff26/kube-upgrade-controller
Tags

There are different flavors of the image:

Tag(s)Description
latestLast released version of the image
rollingRolling update of the image, always build from main branch.
vX.Y.ZReleased version of the image

Architecture

Kube-upgrade consists of 2 components, the upgrade-controller and upgraded. They work together to ensure automatic kubernetes updates across your cluster. It does depend on a fleetlock server to ensure nodes are not updated simoultaneously, as well as for draining nodes beforehand.

Important Notice: When creating a plan, it is always necessary to ensure that the control-plane nodes are upgraded first.

upgrade-controller

The controller runs in the cluster coordinates the upgrades across the cluster by reading the KubeUpgradePlan and annotating nodes with the correct settings. It will do this per group, depending on how the order is defined in the plan.

upgraded

The upgraded daemon runs on each node and upgrades the node in accordance with the annotations provided by upgrade-controller.

Even without kubernetes version upgrades, it will constantly check for new Fedora CoreOS versions in the same stream and update to them.

When it detects an update for kubernetes, it will execute the following:

  1. Reserve a slot with the fleetlock server
  2. Rebase the node into the new version using rpm-ostree
  3. Run kubeadm upgrade node or kubeadm upgrade apply <version>, depending on if it is the first node.

Possible problems when upgrading

So far as i tested, upgrading between patches (e.g. 1.30.3 -> 1.30.4) is going fine. However when upgrading between 1.30 and 1.31, the static pods for kubernetes do not start with a version mismatch (1.30 pod, 1.31 kubelet). This causes the preflight checks to fail. The solution in this case was for me to ignore preflight errors anyway and simply upgrade to 1.31. This fixed the problem.

I think the reason is, that while it is not explicitly stated in the docs (See Links) and kind of hinted it could be done the other way around, the expected way for the upgrade is the following:

  1. Upgrade kubeadm to the newest version
  2. Run kubeadm upgrade (node|apply)
  3. Upgrade kubelet

What upgraded is doing instead is, it upgrades both kubeadm and kubelet at the same time (by rebasing). So in conclusion:

TLDR; Upgrading between patches (e,g, 1.x.y -> 1.x.z) is fine, upgrading between minor versions (e.g. 1.x -> 1.y) should be done with proper planning, lots of tests, caution and quite possible manually.

Tag summary

Content type

Image

Digest

sha256:70230a303

Size

536 Bytes

Last updated

9 days ago

docker pull heathcliff26/kube-upgrade-controller:sha256-2d8637c17e2e640b91e13c4d62e3426dc1ede3863783f0c12028f6a3cb83abf2.sig