Questions tagged [statefulset]

StatefulSets are valuable for applications that require one or more of the following.

  • Stable, unique network identifiers.
  • Stable, persistent storage.
  • Ordered, graceful deployment and scaling.
  • Ordered, graceful deletion and termination.
  • Ordered, automated rolling updates.
91 questions
18
votes
2 answers

Is there a way to get ordinal index of a pod with in kubernetes statefulset configuration file?

We are on Kubernetes 1.9.0 and wonder if there is way to access an "ordinal index" of a pod with in its statefulset configuration file. We like to dynamically assign a value (that's derived from the ordinal index) to the pod's label and later use it…
Raj N
  • 181
  • 1
  • 1
  • 3
14
votes
4 answers

Volume is already exclusively attached to one node and can't be attached to another

I have a pretty simple Kubernetes pod. I want a stateful set and want the following process: I want to have an initcontainer download and uncompress a tarball from s3 into a volume mounted to the initcontainer I want to mount that volume to my main…
LoganHenderson
  • 1,222
  • 4
  • 12
  • 24
11
votes
2 answers

Adding Hospath to a Kubernetes Statefulset

In Kubernetes is it possible to add hostPath storage in Statefulset. If so, can someone help me with some example?
Dinesh
  • 177
  • 1
  • 11
9
votes
1 answer

How can I expose a Statefulset with a load balancer?

I currently trying to create a cluster of X pods witch each have a personal persistent volume. To do that I've created a StateFulSet with X replicas and a PersistentVolumeClaimTemplate This part is working. The problem is that it's seem's to be…
yatsukino
  • 379
  • 1
  • 4
  • 13
9
votes
1 answer

How to specify mountOptions on an existing NFS share

We're creating a kubernetes statefulset that is mounting a pre-existing NFS share. Here's a trimmed down example: apiVersion: apps/v1beta2 kind: StatefulSet metadata: name: hostname spec: replicas: 1 selector: matchLabels: app:…
user1522264
  • 123
  • 1
  • 1
  • 5
8
votes
3 answers

Kubernetes multiple identical app and database deployments with different config

The dilemma: Deploy multiple app and database container pairs with identical docker image and code, but different config (different clients using subdomains). What are some logical ways to approach this, as it doesn't seem kubernetes has an…
Mick
  • 413
  • 4
  • 14
7
votes
1 answer

Kubernetes multiple database instances or HA single instance

I have an Kubernetes environment running multipe applications (services). Now i'm a little bit confused how to setup the MySQL database instance(s). According to different sources each microservice should have there own database. Should i create a…
7
votes
1 answer

How does statefulset and headless service works-K8s

I understood that StatefulSet - manages/maintains stable hostname, network ID and persistent storage. HeadlessService - stable network ID you need to define a headless service for stateful applications FROM K8s Docs -> Sometimes you don’t need…
Veerendra K
  • 2,145
  • 7
  • 32
  • 61
7
votes
2 answers

Kubernetes StatefulSet - obtain spec.replicas metadata and reference elsewhere in configuration

I am configuring a StatefulSet where I want the number of replicas (spec.replicas as shown below) available to somehow pass as a parameter into the application instance. My application needs spec.replicas to determine the numer of replicas so it…
mjkrumlauf
  • 89
  • 1
  • 4
7
votes
2 answers

Service selection from only one pod of one statefulset

It is possible to create a service that only points to a pod, created by a statefulset? The solutions that make me would be: Put as a provider on behalf of the pod. Dynamic labels with the name of the pod.
jbelenus
  • 483
  • 1
  • 7
  • 18
6
votes
1 answer

How to reattach released PersistentVolume in Kubernetes

Here is my overall goal: Have a MongoDB running Persist the data through pod failures / updates etc The approach I’ve taken: K8S Provider: Digital Ocean Nodes: 3 Create a PVC Create a headless Service Create a StatefulSet Here’s a dumbed down…
Jason Awbrey
  • 889
  • 9
  • 11
5
votes
2 answers

How to get number of replicas of StatefulSet Kubernetes

I am trying to autoscale my StatefulSet on Kubernetes. In order to do so, I need to get the current number of pods. When dealing with deployments: kubectl describe deployments [deployment-name] | grep desired | awk '{print $2}' | head -n1 This…
5
votes
2 answers

Kubernetes: NFS with StatefulSets

I'm trying to use existing NFS with StateFulSets. Creation of PresistentVolumeClaim seems automatic using the volumeClaimTemplates. Problem: But, since the PresistentVolumeClaim claims a entire PresistentVolume. I have to create PresistentVolume…
4
votes
2 answers

Immediately scale up Kubernetes Statefulset/Deployment to full capacity

currently we scaled one of our statefulsets to have 11 replicas. Our current updateStrategy is updateStrategy: type: RollingUpdate If we deploy the statefulset from scratch, Kubernetes starts them one after another. To start one replica it needs…
Stephan
  • 323
  • 2
  • 11
4
votes
1 answer

StatefulSet, ReplicaSet or DaemonSet. What is the best for a single Pod?

I want to deploy a single Pod on a Node to host my service (like GitLab for the example). The problem is : a Pod will not be re-created after the Node failure (like a reboot). The solution(s) : Use a StatefulSet, ReplicaSet or DaemonSet to ensure…
Nurza
  • 201
  • 2
  • 10
1
2 3 4 5 6 7