Kubernetes Statefulset access and downtime

2/16/2020

I did read up on StatefulSets which I want to use for some stateful applications, and was wondering about two things?

1) Do I need to put a service in front? Or do I just dns query the single instances, and they do have a static ip like with a service by default, disregarding what pod runs behind?

2) How does a statefulset behave when a given pod X is down? I suppose with my theory of it having a kind of "internal" service, it will just hold back any requests done while the pod behind the IP is down until a new one is there?

-- Sossenbinder
kubernetes

1 Answer

2/16/2020

1) Do I need to put a service in front? Or do I just dns query the single instances, and they do have a static ip like with a service by default, disregarding what pod runs behind?

StatefulSets currently require a Headless Service to be responsible for the network identity of the Pods. You are responsible for creating this Service.

2) How does a statefulset behave when a given pod X is down? I suppose with my theory of it having a kind of "internal" service, it will just hold back any requests done while the pod behind the IP is down until a new one is there?

StatefulSet ensures that, at any time, there is at most one Pod with a given identity running in a cluster. This is referred to as at most one semantics provided by a StatefulSet.The StatefulSet also recreates Pods if they’re deleted, similar to what a ReplicaSet does for stateless Pods.

-- Arghya Sadhu
Source: StackOverflow