forked from carlosedp/kubernetes-elasticsearch-cluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
es-data-statefulset.yaml
106 lines (106 loc) · 2.58 KB
/
es-data-statefulset.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: es-data
namespace: logging
labels:
component: elasticsearch
role: data
spec:
serviceName: elasticsearch-logging
replicas: 2
selector:
matchLabels:
component: elasticsearch
role: data
template:
metadata:
labels:
component: elasticsearch
role: data
spec:
initContainers:
- name: init-sysctl
image: busybox:1.27.2
command:
- sysctl
- -w
- vm.max_map_count=262144
securityContext:
privileged: true
containers:
- name: es-data
image: carlosedp/docker-elasticsearch-kubernetes:6.2.3
resources:
limits:
cpu: 2
requests:
cpu: 1
ports:
- containerPort: 9300
name: transport
env:
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: CLUSTER_NAME
value: myesdb
- name: NODE_MASTER
value: "false"
- name: NODE_INGEST
value: "false"
- name: HTTP_ENABLE
value: "false"
- name: ES_JAVA_OPTS
value: -Xms1g -Xmx1g
- name: PROCESSORS
valueFrom:
resourceFieldRef:
resource: limits.cpu
#- name: "ES_PLUGINS_INSTALL"
# value: "x-pack"
livenessProbe:
tcpSocket:
port: transport
initialDelaySeconds: 180
periodSeconds: 10
#readinessProbe:
# tcpSocket:
# port: transport
# initialDelaySeconds: 30
# periodSeconds: 20
volumeMounts:
- name: config
mountPath: /elasticsearch/config/elasticsearch.yml
subPath: elasticsearch.yml
- name: storage-data
mountPath: /data
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: role
operator: In
values:
- data
topologyKey: kubernetes.io/hostname
volumes:
- name : config
configMap:
name: es-configmap
volumeClaimTemplates:
- metadata:
name: storage-data
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 20Gi