Achieving High Availability #805
-
Hi there. I am new to Kubernetes and your repo has been immensely helpful, thank you! As part of my learning I decided to start migrating my homelab cluster to kube and am sorta building the plane while its flying. Everything has been reasonably straight forward so far, however I am having trouble achieving a HA setup. I appreciate none of this is specific to this particular repo, but given the components are familiar with those using this template, maybe people have ideas or could learn from the outcome of this discussion. My setup is as follows: (repo: https://github.com/adampetrovic/k8s-home)
In my pursuit of learning I have tried adding a bit of chaos engineering into my testing by shutting a master node and its colocated worker node to see what happens. Whenever I kill a master node though, things break in strange ways. Presumably because I'm not running everything in an optimal fashion. Firstly, the node enters Looking at the typical service that relies on postgres and redis, the pods enter a 'Terminating' state forever and never get rescheduled onto another healthy node:
My immediate thought is to label my nodes to indicate which physical node they reside on, then ensure that pods don't 'double up' on the same physical node. Though the questions I have are:
Judging from this stackoverflow answer, this is by design. Pods won't get rescheduled until the node is forcefully deleted. My follow question to this is, is there any way around this? In a truly HA setup, user intervention shouldn't be required in order for the system to continue working.
Thanks in advance for any advice. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This is very dependent on the application and what underlaying storage is being used. Try this with a stateless service (like echo-server) and it should behave as you expect.
That is a feature of
I don't really have a great answer here because it is pretty much up to the applications to figure out what to do, not much on kubernetes. Basically stateful workloads in Kubernetes are still pretty painful but you will learn to live with their nuances. |
Beta Was this translation helpful? Give feedback.
This is very dependent on the application and what underlaying storage is being used. Try this with a stateless service (like echo-server) and it should behave as you expect.
That is a feature of
statefulset
, they will live on the node they were created on unless there is human interaction to say otherwise or the node becomes healthy again. The only other alternative is to use adeployment
instead but even that will leave pods stuck in ter…