Skip to content

Instantly share code, notes, and snippets.

@imsuwj imsuwj/es-data.yaml
Created Jul 30, 2019

Embed
What would you like to do?
apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
app: elasticsearch
role: data
name: elasticsearch-data
spec:
replicas: 2
serviceName: elasticsearch-data
selector:
matchLabels:
app: elasticsearch
role: data
template:
metadata:
labels:
app: elasticsearch
role: data
spec:
securityContext:
fsGroup: 1000
restartPolicy: Always
initContainers:
- name: configure-sysctl
securityContext:
runAsUser: 0
privileged: true
image: registry.custom.com/elasticsearch:7.2.0
command: ["/bin/bash", "-c", "sysctl -w vm.max_map_count=262144;"]
resources:
{}
containers:
- name: elasticsearch-data
image: registry.custom.com/elasticsearch:7.2.0
imagePullPolicy: IfNotPresent
securityContext:
privileged: true
ports:
- containerPort: 9300
protocol: TCP
env:
- name: cluster.name
value: "es_cluster"
- name: node.master
value: "false"
- name: node.data
value: "true"
- name: node.ingest
value: "true"
- name: discovery.seed_hosts
value: "elasticsearch-discovery"
- name: bootstrap.memory_lock # 开启
value: 'true'
- name: ES_JAVA_OPTS
value: "-Xms1536m -Xmx1536m"
volumeMounts:
- name: es-data
mountPath: /usr/share/elasticsearch/data
volumes:
- name: es-data
hostPath:
path: /data/elasticsearch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.