statefulset

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

北城以北 提交于 2019-12-22 14:39:02
问题 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 label. I've already got a workaround ready in the form of a container. However I'd still like to know if this is possible out of the box. 回答1: You can't threat a pod inside the same StatefulSet as a special pod. Simply because you can only specify a single PodSpec that's valid for the whole set.

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

孤街醉人 提交于 2019-12-14 01:47:55
问题 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 knows what rows to load from a MySQL table. I don't want to hard-code the number of replicas in both spec.replicas and the application parameter as that will not work when scaling the number of replicas up or down, since the application parameter

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

99封情书 提交于 2019-12-07 15:03:33
问题 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 for setting pod affinity (or antiaffinity) under spec. Alternatively, is the pod's instance name available with in statefulset configfile? If so, we can hopefully extract ordinal index from it and dynamically assign to a label (for later use for

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

依然范特西╮ 提交于 2019-12-05 23:31:55
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 for setting pod affinity (or antiaffinity) under spec. Alternatively, is the pod's instance name available with in statefulset configfile? If so, we can hopefully extract ordinal index from it and dynamically assign to a label (for later use for affinity). Right now the only option is to extract index from host name lifecycle: postStart: exec: