Deploy stateful applications in Kubernetes

I am getting to know Kubernetes and have not found a simple solution to deploy stateful services in Kubernetes.

  • Each block must be loaded using contact points (a list of other IP addresses) that cannot be balanced by load (I am afraid of a brain split in case of failure: in the worst case, load-balancer can load - balance each set for itself, creating several self-closed clusters of one node)
  • Each block must have persistent storage, which in the worst case should be manually accessible (e.g. consul peers.json)
  • Each container must be reconfigured; if I forgot to do something with my consul clan, restoring it from scratch will simply lead to downtime. In case kubernetes prevents this, do not hesitate to tell me, I am still not well versed in deployment mechanics.
  • Dynamically expanding a service cluster with newly configured instances and then dropping old ones can be extremely undesirable (I'm not a consul specialist, but from my point of view, which reduces protection against brain splitting in a consul cluster).

AFAIK the most applicable thing is the Pet Set, however it is still in alpha and can be completely removed; In addition, I don’t feel that I understand how to maintain stable volumes in order to survive. Another option that I came across is to separate the service deployments into bootstrap deployments - node, boot - node and deploy all other nodes, which allows me to use the bootstrap - node service as a contact point (which is not completely safe, though).

What are the popular approaches to this business and what are the pros and cons of them?

+6
source share
1 answer

If you are viewing a certain number of subnets in your cluster while maintaining state in the Kubernetes cluster, PetSets (StatefulSets, in my opinion, it is being called now) is the answer ... or you can define Service per Pod to achieve the same.

To let Pods learn about other Pods IP addresses, you can use Headless Services, which provide you with a list of IP addresses associated with the tag.

For storage, if you use emptyDir, you have local storage, but you lose it when the Pod is deleted / rescheduled.

I use Zookeeper in Kubernetes, and it’s a little painful to configure, but Zookeeper provides a “reconfigurable” API that allows you to reconfigure the cluster when the node changes, so it’s quite simple to override the cluster to start a new node when remodeling the Pod. I'm not sure that the Consul has the same type of function, but it probably does.

+1
source

All Articles