-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathES_StatefulSet.yaml
87 lines (87 loc) · 2.59 KB
/
ES_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
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: sample-elasticsearch
labels:
service: sample-elasticsearch
spec:
serviceName: sample-elasticsearch-discovery
# Number of PODS
replicas: 1
selector:
matchLabels:
service: sample-elasticsearch
template:
metadata:
labels:
service: sample-elasticsearch
spec:
terminationGracePeriodSeconds: 15
initContainers:
# https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html
- name: increase-the-vm-max-map-count
image: busybox
command:
- sysctl
- -w
- vm.max_map_count=262144
securityContext:
privileged: true
- name: fix-the-volume-permission
image: busybox
command: ["sh", "-c", "chown -R 1000:1000 /usr/share/elasticsearch/data"]
securityContext:
privileged: true
volumeMounts:
- name: sample-elasticsearch-data-claim
mountPath: /usr/share/elasticsearch/data
containers:
- name: sample-elasticsearch
image: docker.elastic.co/elasticsearch/elasticsearch:6.4.1
resources:
limits:
cpu: 2000m
memory: 2Gi
requests:
cpu: 100m
memory: 1Gi
ports:
- containerPort: 9200
name: http
- containerPort: 9300
name: tcp
env:
- name: cluster.name
value: "sample-elasticsearch-cluster"
- name: "xpack.security.enabled"
value: "true"
- name: "TAKE_FILE_OWNERSHIP"
value: “1”
- name: node.name
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: discovery.zen.ping.unicast.hosts
value: "sample-elasticsearch-discovery:9300"
volumeMounts:
- name: sample-elasticsearch-data-claim
mountPath: /usr/share/elasticsearch/data
- name: sample-elasticsearch-configmap
mountPath: /usr/share/elasticsearch/config/elasticsearch.yml
subPath: elasticsearch.yml
- name: sample-elasticsearch-configmap
mountPath: /usr/share/elasticsearch/config/role_mapping.yml
subPath: role_mapping.yml
volumes:
- name: sample-elasticsearch-configmap
configMap:
name: sample-elasticsearch-configmap
volumeClaimTemplates:
- metadata:
name: sample-elasticsearch-data-claim
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: default
resources:
requests:
storage: 2Gi