Skip to content

Instantly share code, notes, and snippets.

@wayjam
Created July 30, 2019 16:32
Show Gist options
  • Save wayjam/14ae9c72271e859938a6fd1dc668f271 to your computer and use it in GitHub Desktop.
Save wayjam/14ae9c72271e859938a6fd1dc668f271 to your computer and use it in GitHub Desktop.
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