kubernetes-statefulset

How to extract volumeClaimTemplates to a separate PersistentVolumeClaim yaml file?

可紊 提交于 2020-06-29 04:19:10
问题 Let's say I have a StatefulSet definition apiVersion: v1 kind: StatefulSet metadata: name: web spec: ... volumeClaimTemplates: — metadata: name: www spec: resources: requests: storage: 1Gi This will create me a PersistentVolumeClaim (PVC) with a PersistentVolume (PV) of 1 GiB for each pod. How can I write something like this apiVersion: v1 kind: PersistentVolumeClaim metadata: name: www spec: ... resources: requests: storage: 1Gi ... and connect it with the StatefulSet in a way that it still

apply HPA for Statefulset in kubernetes?

不问归期 提交于 2020-06-11 08:45:13
问题 I am trying to setup HPA for my statefulset(for elasticsearch) in kubernetes environment. I am planning to scale the statefulset using the cpu utilization. I have created the metric server from https://github.com/stefanprodan/k8s-prom-hpa/tree/master/metrics-server. and my HPA yaml for statefulset is as folows: apiVersion: autoscaling/v2beta1 kind: HorizontalPodAutoscaler metadata: name: dz-es-cluster spec: scaleTargetRef: apiVersion: extensions/v1beta1 kind: StatefulSet name: dz-es-cluster

Redis Pods are not able to join Redis cluster

微笑、不失礼 提交于 2020-01-25 06:52:33
问题 I want to create redis cluster of 6 nodes in kubernetes. I am running kubernetes using Minikube . Below is my implementation for creating the 6 node cluster. kind: StatefulSet metadata: generation: 1 labels: app: demo-app name: demo-app namespace: default spec: podManagementPolicy: OrderedReady replicas: 6 revisionHistoryLimit: 10 selector: matchLabels: app: demo-app serviceName: "" template: metadata: creationTimestamp: null labels: app: demo-app spec: containers: - command: - redis-server -

Kubernetes service architecture

妖精的绣舞 提交于 2019-12-24 08:17:09
问题 Within the same kubernetes cluster, Can I have multiple StatefulSets attached to one headless service or should each StatefulSet have it's own headless service? What are the pros and cons of doing this? Can I mix standard and headless services in the same cluster? Specifically, I would like to use LoadBalancer service to load balance headless services. Can I define a service of type LoadBalancer and have headless services (ClusterIP = None) attached to it? If yes, how can I achieve this? Here

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

Why StatefulSets? Can't a stateless Pod use persistent volumes?

烈酒焚心 提交于 2019-11-30 10:26:39
问题 I am trying to understand Stateful Sets. How does their use differ from the use of "stateless" Pods with Persistent Volumes? That is, assuming that a "normal" Pod may lay claim to persistent storage, what obvious thing am I missing that requires this new construct (with ordered start/stop and so on)? 回答1: Yes, a regular pod can use a persistent volume. However, sometimes you have multiple pods that logically form a "group". Examples of this would be database replicas, ZooKeeper hosts, Kafka

Why StatefulSets? Can't a stateless Pod use persistent volumes?

自闭症网瘾萝莉.ら 提交于 2019-11-29 20:15:44
I am trying to understand Stateful Sets . How does their use differ from the use of "stateless" Pods with Persistent Volumes? That is, assuming that a "normal" Pod may lay claim to persistent storage, what obvious thing am I missing that requires this new construct (with ordered start/stop and so on)? Yes, a regular pod can use a persistent volume. However, sometimes you have multiple pods that logically form a "group". Examples of this would be database replicas, ZooKeeper hosts, Kafka nodes, etc. In all of these cases there's a bunch of servers and they work together and talk to each other.