Questions tagged [statefulset]

The tag has no usage guidance, but it has a tag wiki.

statefulset
Filter by
Sorted by
Tagged with
22 votes
3 answers
23k views

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 ...
Raj N's user avatar
  • 221
17 votes
5 answers
51k views

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 ...
LoganHenderson's user avatar
11 votes
2 answers
8k views

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's user avatar
  • 177
11 votes
1 answer
15k views

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 ...
yatsukino's user avatar
  • 419
9 votes
1 answer
14k views

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: ...
user1522264's user avatar
8 votes
2 answers
2k views

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....
mjkrumlauf's user avatar
8 votes
3 answers
2k views

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 ...
Mick's user avatar
  • 413
7 votes
1 answer
4k views

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 ...
EntonoX's user avatar
  • 81
7 votes
1 answer
11k views

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 ...
Veerendra K's user avatar
  • 2,197
7 votes
2 answers
3k views

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 ...
jbelenus's user avatar
  • 483
6 votes
2 answers
18k views

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] | ...
DUDANF's user avatar
  • 2,795
6 votes
1 answer
5k views

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 ...
Jason Awbrey's user avatar
5 votes
2 answers
7k views

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 ...
Shan's user avatar
  • 2,161
4 votes
1 answer
6k views

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 ...
Nurza's user avatar
  • 211
4 votes
2 answers
3k views

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 ...
Stephan's user avatar
  • 343
4 votes
1 answer
4k views

Add additional volumeClaimTemplate to statefulSet

We are using Kubernetes 1.10.1 I'm having a statefulset which has a single volumeClaim attached. I would like to add an additional volumeClaim since resizing of an existing PV is still in beta and ...
mat1010's user avatar
  • 796
4 votes
1 answer
3k views

StatefulSet behavior when a node dies/gets restarted and has a PersistentVolume

Suppose I have a resource foo which is a statefulset with 3 replicas. Each makes a persistent volume claim. One of the foo pods (foo-1) dies, and a new one starts in its place. Will foo-1 be bound ...
FrobberOfBits's user avatar
4 votes
2 answers
3k views

How to add a Configmap to a specific Pod In a StatefulSet?

I'd like to know how I can add a ConfigMap to a specific pod spawned by a StatefulSet. I've looked at the spec and I can't figure out how to ensure that a pod only mounts a ConfigMap with a specific ...
Byebye's user avatar
  • 1,022
4 votes
1 answer
1k views

Kubernetes StatefulSet pod startup error recovery

A Kubernetes StatefulSet (v1.8) will automagically rollover the pods it is managing to a new image if you patch the image name in the StatefulSet spec -- orchestrating this kind of update is one of ...
Chip Morningstar's user avatar
4 votes
2 answers
2k views

Can I use existing GCE persistent disk in volumeClaimTemplate of Kubernetes Statefulset

I am using Google Container Engine to run a StatefulSet for MongoDB replica set (3 replica pods). This works fine with dynamic provisioning of persistent storage - that is new storage is provisioned ...
conundrum's user avatar
3 votes
1 answer
6k views

Strategy Replace for StatefulSet

I have simple issue with StatefulSet update on my dev environment and CI. I want to replace all StatefulSet replicas instantly without using Kubectl delete first. Is it possible to change the manifest ...
mkasepuu's user avatar
  • 243
3 votes
1 answer
2k views

Kubernetes - How to create one Pod per Node?

I want a Kubernetes StatefulSet with: Number of Replicas/Pods = Number of Nodes in Kubernetes Cluster One Pod on on every node Is there a simple example on how to solve this typical requirement?
Simon_Prewo's user avatar
  • 1,239
3 votes
2 answers
1k views

Kubernetes: Expose only single pod of StatefulSet

For for a StateFul set, I can access its pods via a headless service internally. I think, it would make sense, to have an easy way to expose also single pods externally (since the pods usually have a ...
Christof Tinnes's user avatar
3 votes
1 answer
3k views

Helm / Kubernetes - Statefulset & Permissions

I keep seeing this error: Events: FirstSeen LastSeen Count From SubObjectPath Type Reason Message --------- -------- ----- ---- ------------- -------- --...
IAspireToBeGladOS's user avatar
3 votes
1 answer
651 views

Is there a way/config where I could change default revisionHistoryLimit from 10 to another limit?

I'm setting up a new server with kubernetes and because of storage limitations I need to change revisionHistoryLimit for all our existing and new projects to 2 or 3. I know I can change it in each ...
Michael Dostál's user avatar
3 votes
0 answers
853 views

Route to a given replica of a statefulset in Openshift/Kubernetes

Do you know if there is a way with the statefulset feature in kubernetes/openshift to create 1 route per replica (ie 1 route that will allow me to access from the outside 1 specific replica of my ...
Julien's user avatar
  • 55
2 votes
1 answer
2k views

Kubernetes StatefulSets and livenessProbes

Liveness probes are supposed to trigger a restart of failed containers. Do they respect the default stateful set deployment and scaling guarantees. E.g. if the liveness probe fails at the same time ...
André Menneken's user avatar
2 votes
2 answers
3k views

How to forward Traffic to specific pod?

I have an app which using in memory database. I created statefulset using the Pod with let's say 3 replica. used PVC for storing the database related files. I used a Loabalancer to expose the ...
Karthik's user avatar
  • 764
2 votes
3 answers
1k views

Why not to use Kubernetes StatefulSet for stateless applications?

I know why use StatefulSet for stateful applications. (e.g. DB or something) In most cases, I can see like "You want to deploy stateful app to k8s? Use StatefulSet!" However, I couldn't see ...
Eddy Kim's user avatar
2 votes
2 answers
520 views

K8s: StatefulSet how to increase time between resatrt of pod in case fails

I have integration test, where i start StatefulSet, wait untill ready and then do some asserts. My problem that if Application fails - it try to restart too fast. And I can't get logs from failed pod....
Grigoriev Nick's user avatar
2 votes
2 answers
1k views

How can I mount a single distinct Secret into each Pod managed by a StatefulSet?

I have 3 different Kubernetes Secrets and I want to mount each one into its own Pod managed by a StatefulSet with 3 replicas. Is it possible to configure the StatefulSet such that each Secret is ...
dippynark's user avatar
  • 2,883
2 votes
3 answers
707 views

Deploy a scalable application on Kubernetes which requires each replica Pod to have different args

I am trying to understand how to deploy an application on Kubernetes which requires each Pod of the same deployment to have different args used with the starting command. I have this application ...
AndD's user avatar
  • 2,521
2 votes
2 answers
448 views

Kubernetes control the order of scale and upgrade for a StatefulSet

I have the following scenario: A StatefulSet with 1 replica Update the template section and scale it in the same operation using helm as application manager The order of operation is the following: ...
Alin Alexandru Baicu's user avatar
2 votes
0 answers
1k views

Sequential Creation of pods in a kubernetes StatefulSet

I am having difficulties with deploying my application which needs to know inside state of the cluster regarding the particular statefulset and behave accordingly. So in my deployment.yml file, I add ...
Damith's user avatar
  • 750
1 vote
1 answer
3k views

StatefulSet with Postgres and one replica

If i deploy Postgres in a statefulSet without using replicas (just one pod) and i kill the node that the stateful set is running on will I be able to start up the node and reconnect to a persisted ...
Happy Machine's user avatar
1 vote
1 answer
17k views

Kubernetes Node Affinity and statefulsets

I'm looking to create a statefulset using affinity. I have added a label to my 3 nodes. Two of them have area=area1 and one node has area=area2. I'm looking to run my statefulset pods only on the ...
Nestor Camino's user avatar
1 vote
2 answers
2k views

How to guarantee even spread pod distribution across AZ in Kubernetes StatefulSet

I deployed a K8s StatefulSet with 30 replicas (or N replicas, where N is multiple of 3) in EKS Cluster. EKS cluster is with 3 nodes, one node for one AZ, and I want to guarantee with Kubernetes ...
falberto's user avatar
1 vote
1 answer
4k views

Mount PVC in cronjob and statefulset

I have two services that I would like to access a PersistentVolumeClaim. One is a StatefulSet that is reading from the volume (and serving content to end users), the other is a Kubernetes CronJob ...
Darrien's user avatar
  • 71
1 vote
1 answer
4k views

Kubernetes: use volumeClaimTemplate to select admin-provisioned PersistentVolume

I have created some Persistent Volumes myself. Is it possible to make the volumeClaimTemplates in my Stateful Set select those? It seems that it will always provision new persistent volumes, rather ...
Niel de Wet's user avatar
  • 8,176
1 vote
1 answer
387 views

Scale up mysql with hpa creates an empty database on Kubernetes

I have a cluster with MySQL database which is a StatefulSet. I would like to scale up my database with hpa. The problem is that the second database that has been created is empty. I don't know how to ...
alex's user avatar
  • 353
1 vote
1 answer
457 views

How to tweak Redis config with Kubernetes statefulset?

I am fine with Redis' default redis.conf, but would just like to change "appendonly" from the default of "no" to "yes". Kubernetes statefulset is, in part: spec: ...
Zeke MC's user avatar
  • 75
1 vote
1 answer
3k views

Create a new volume when pod restart in a statefulset

I'm using azure aks to create a statefulset with volume using azure disk provisioner. I'm trying to find a way to write my statefulset YAML file in a way that when a pod restarts, it will get a new ...
toto's user avatar
  • 1,337
1 vote
1 answer
862 views

Kubernetes PersistentVolumeClaim issues in AWS using Pod Autoscaling

We have success creating the pods, services and replication controllers according to our project requirements. Now we are planning to setup persistence storage in AWS using Kubernetes. I have created ...
Raju's user avatar
  • 61
1 vote
2 answers
4k views

How to rollaback Kubernetes StatefulSet application

Currently, I am migrating one of our microservice from K8S Deployment type to StatefulSets. While updating Kubernetes deployment config I noticed StatefulSets doesn't support revisionHistoryLimit and ...
pragmaticEngineer's user avatar
1 vote
1 answer
3k views

Kubernetes Helm Chart - Debugging

I'm unable to find good information describing these errors: [sarah@localhost helm] helm install statefulset --name statefulset --debug [debug] Created tunnel using local port: '33172' [debug] ...
IAspireToBeGladOS's user avatar
1 vote
2 answers
754 views

Run MongoDB in Kubernetes with Keyfile

i try to run a mongodb within a kubernetes cluster secured with a keyFile. For this, i created a simple statefulset and a configmap, where i stored the keyfile: apiVersion: apps/v1 kind: StatefulSet ...
MarM25's user avatar
  • 13
1 vote
0 answers
337 views

How to uninstall the resource of dependency chart when I uninstall the main chart Release?

Currently, I am using helm 3 , dependency chart to deploy a bitnami/postgresql statefulset with a nodeJS application, however, the postgresql statefulset is still there when I uninstall the release. ...
devlooper's user avatar
1 vote
0 answers
304 views

Istio RabbitMQ StatefulSets Peer Discovery

I have a RabbitMQ cluster running in Kubernetes. It works as expected without the Istio injection enabled. Unfortunately, the cluster crashes when the istio-injection is enabled. This is caused by the ...
Yiadh TLIJANI's user avatar
1 vote
0 answers
4k views

Unable to attach or mount volumes in Kubernetes

Since I updated my Digital Ocean cluster to Kubernetes 1.21, I have multiple errors mounting nfs volumes on deployments and statefulsets like this one : Unable to attach or mount volumes: unmounted ...
Quentin Arrachart's user avatar
1 vote
0 answers
104 views

hpa doesn't share cpu traffic to replicas

This is my hpa yaml file: apiVersion: autoscaling/v2beta2 kind: HorizontalPodAutoscaler metadata: name: mysql-hpa spec: maxReplicas: 2 minReplicas: 1 scaleTargetRef: apiVersion: apps/v1 ...
alex's user avatar
  • 353