Skip to content

Commit 5e1519c

Browse files
committed
Kubernetes: Add elasticsearch manifests
Signed-off-by: NotHarshhaa <[email protected]>
1 parent abd9133 commit 5e1519c

File tree

2 files changed

+91
-0
lines changed

2 files changed

+91
-0
lines changed

Diff for: elasticsearch/es-sts.yaml

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
apiVersion: apps/v1
2+
kind: StatefulSet
3+
metadata:
4+
name: es-cluster
5+
spec:
6+
serviceName: elasticsearch
7+
replicas: 3
8+
selector:
9+
matchLabels:
10+
app: elasticsearch
11+
template:
12+
metadata:
13+
labels:
14+
app: elasticsearch
15+
spec:
16+
containers:
17+
- name: elasticsearch
18+
image: docker.elastic.co/elasticsearch/elasticsearch:7.5.0
19+
resources:
20+
limits:
21+
cpu: 1000m
22+
requests:
23+
cpu: 100m
24+
ports:
25+
- containerPort: 9200
26+
name: rest
27+
protocol: TCP
28+
- containerPort: 9300
29+
name: inter-node
30+
protocol: TCP
31+
volumeMounts:
32+
- name: data
33+
mountPath: /usr/share/elasticsearch/data
34+
env:
35+
- name: cluster.name
36+
value: k8s-logs
37+
- name: node.name
38+
valueFrom:
39+
fieldRef:
40+
fieldPath: metadata.name
41+
- name: discovery.seed_hosts
42+
value: "es-cluster-0.elasticsearch,es-cluster-1.elasticsearch,es-cluster-2.elasticsearch"
43+
- name: cluster.initial_master_nodes
44+
value: "es-cluster-0,es-cluster-1,es-cluster-2"
45+
- name: ES_JAVA_OPTS
46+
value: "-Xms512m -Xmx512m"
47+
initContainers:
48+
- name: fix-permissions
49+
image: busybox
50+
command: ["sh", "-c", "chown -R 1000:1000 /usr/share/elasticsearch/data"]
51+
securityContext:
52+
privileged: true
53+
volumeMounts:
54+
- name: data
55+
mountPath: /usr/share/elasticsearch/data
56+
- name: increase-vm-max-map
57+
image: busybox
58+
command: ["sysctl", "-w", "vm.max_map_count=262144"]
59+
securityContext:
60+
privileged: true
61+
- name: increase-fd-ulimit
62+
image: busybox
63+
command: ["sh", "-c", "ulimit -n 65536"]
64+
securityContext:
65+
privileged: true
66+
volumeClaimTemplates:
67+
- metadata:
68+
name: data
69+
labels:
70+
app: elasticsearch
71+
spec:
72+
accessModes: [ "ReadWriteOnce" ]
73+
# storageClassName: ""
74+
resources:
75+
requests:
76+
storage: 3Gi

Diff for: elasticsearch/es-svc.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
kind: Service
2+
apiVersion: v1
3+
metadata:
4+
name: elasticsearch
5+
labels:
6+
app: elasticsearch
7+
spec:
8+
selector:
9+
app: elasticsearch
10+
clusterIP: None
11+
ports:
12+
- port: 9200
13+
name: rest
14+
- port: 9300
15+
name: inter-node

0 commit comments

Comments
 (0)