forked from apk8s/book-source
-
Notifications
You must be signed in to change notification settings - Fork 0
/
40-statefulset.yml
75 lines (75 loc) · 2.22 KB
/
40-statefulset.yml
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
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: elasticsearch
namespace: data
labels:
app: elasticsearch
spec:
serviceName: elasticsearch
replicas: 1 # single node cluster
selector:
matchLabels:
app: elasticsearch
template:
metadata:
labels:
app: elasticsearch
spec:
initContainers:
- name: init-sysctl
image: busybox:1.27.2
command: ["sysctl", "-w", "vm.max_map_count=262144"]
securityContext:
privileged: true
- name: init-chown
image: busybox:1.27.2
command: ["/bin/sh"]
args: ["-c", "chown -R 1000:1000 /usr/share/elasticsearch/data"]
securityContext:
privileged: true
volumeMounts:
- name: es-data
mountPath: /usr/share/elasticsearch/data
containers:
- name: elasticsearch
image: docker.elastic.co/elasticsearch/elasticsearch:7.1.1
imagePullPolicy: IfNotPresent
env:
- name: "discovery.type"
value: "single-node"
- name: "cluster.name"
value: "apk8s"
- name: "transport.host"
value: "127.0.0.1"
- name: "ES_JAVA_OPTS"
value: "-Xms512m -Xmx512m"
- name: "http.host"
value: "0.0.0.0"
- name: "http.port"
value: "9200"
- name: "http.cors.allow-origin"
value: "http://localhost:1358"
- name: "http.cors.enabled"
value: "true"
- name: "http.cors.allow-headers"
value: "X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization"
- name: "http.cors.allow-credentials"
value: "true"
ports:
- containerPort: 9200
name: http-es
- containerPort: 9300
name: tcp-es
volumeMounts:
- name: es-data
mountPath: /usr/share/elasticsearch/data
volumeClaimTemplates:
- metadata:
name: es-data
spec:
storageClassName: rook-ceph-block
accessModes: [ ReadWriteOnce ]
resources:
requests:
storage: 50Gi