Automatic upgrade and statefulset workloads #1108
-
DescriptionHello! There is limited information in the documentation regarding how node auto-upgrades function when using a database in Kubernetes or Longhorn. Could you please explain how auto-upgrades work in such a scenario? Just disable it or how? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
@smokfyz For k3s auto upgrades, nothing happens basically, the binary is replaced without even kube going down. Now for node upgrades, that's more invasive. Node upgrades provoke the nodes to be drained and uncordoned from the cluster for reboot, one after another, so super important to be in HA. This I guess would be problematic unless you have longhorn correctly setup in an HA fashion, if you are in HA it should be seemless IMHO as longhorn would have distributed the data in duplicates across the cluster. Same for the statefulset it should not be a problem if configured in an HA fashion. But I must admit am not an expert in working with them. @kube-hetzner/core Please correct me if I'm wrong 🙏 |
Beta Was this translation helpful? Give feedback.
-
Here's what I was able to get out of GPT-4: Node upgrades and the management of StatefulSets in a High Availability (HA) Kubernetes cluster, particularly with automatic node upgrades, present a complex but manageable scenario. Here are some thoughts and considerations:
In summary, while automatic node upgrades in an HA Kubernetes cluster offer many benefits in terms of reducing manual overhead and ensuring up-to-date systems, they require careful planning, robust infrastructure setup (especially for stateful applications), and thorough testing to ensure smooth operations without significant service disruptions. |
Beta Was this translation helpful? Give feedback.
-
@smokfyz If you're using Longhorn I suggest disabling automatic upgrades since there's a bug in Longhorn preventing the nodes to fully drain and this bug leaves the nodes cordoned meaning you're paying for resources that aren't being utilized. I'm currently manually updating my nodes once per week until the bug is fixed. On the other hand, cloudnative-pg works flawlessly with automatic upgrades. Just ensure you have backups and WAL on an external S3 bucket if something goes wrong. |
Beta Was this translation helpful? Give feedback.
-
I would like to add that if you use Hashicorp Vault together with Longhorn storage, there are some caveats too. Vault uses a pod disruption budget on the persistent volumes which is configured such that its pods cannot be evicted unless another three replicas would remain after the eviction. So you need 4 replicas. But on top of that, once a pod was evicted, the node updated, and the pod is rescheduled, this Vault pod does not become ready until you unseal it. As a consequence, until you unseal it, the three remaining replicas cannot be evicted, and the update process comes to a halt (and one node remains cordoned, waiting for the update process to continue). All in all, for me it only works if you have 4 vault replicas and auto-unseal configured, so the pods come online again after rescheduling and the next vault pod can be evicted for the update process. It took me quite a while to understand this. The key to understanding why a note is stuck on cordoned state, is to check the logs of the kured instance on that machine. Use
|
Beta Was this translation helpful? Give feedback.
@smokfyz If you're using Longhorn I suggest disabling automatic upgrades since there's a bug in Longhorn preventing the nodes to fully drain and this bug leaves the nodes cordoned meaning you're paying for resources that aren't being utilized. I'm currently manually updating my nodes once per week until the bug is fixed.
On the other hand, cloudnative-pg works flawlessly with automatic upgrades. Just ensure you have backups and WAL on an external S3 bucket if something goes wrong.