Skip to content

Instantly share code, notes, and snippets.

@jawher
Created September 20, 2019 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jawher/db9973ccafc8fa7ba379e603d90e6681 to your computer and use it in GitHub Desktop.
Save jawher/db9973ccafc8fa7ba379e603d90e6681 to your computer and use it in GitHub Desktop.
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: es-node
labels:
app: es-cluster
spec:
serviceName: elasticsearch
replicas: 2
updateStrategy:
type: RollingUpdate
template:
metadata:
labels:
app: es-node
spec:
securityContext:
fsGroup: 1000
initContainers:
- name: init-sysctl
image: busybox
imagePullPolicy: IfNotPresent
securityContext:
privileged: true
command: ["sysctl", "-w", "vm.max_map_count=262144"]
containers:
- name: elasticsearch
resources:
requests:
memory: 1Gi
securityContext:
privileged: true
runAsUser: 1000
capabilities:
add:
- IPC_LOCK
- SYS_RESOURCE
image: docker.elastic.co/elasticsearch/elasticsearch:7.3.1
env:
- name: discovery.seed_hosts
value: "es-node.${namespace}.svc.cluster.local"
- name: cluster.initial_master_nodes
value: "es-node-0,es-node-1"
- name: ES_JAVA_OPTS
value: -Xms1g -Xmx1g
- name: cluster.name
value: bc-es-cluster
- name: bootstrap.memory_lock
value: "false"
- name: xpack.security.enabled
value: "false"
- name: xpack.monitoring.enabled
value: "false"
- name: network.host
value: "0.0.0.0"
- name: node.name
valueFrom:
fieldRef:
fieldPath: metadata.name
readinessProbe:
httpGet:
scheme: HTTP
path: /_cluster/health?local=true
port: 9200
initialDelaySeconds: 5
ports:
- containerPort: 9200
name: es-http
- containerPort: 9300
name: es-transport
volumeMounts:
- name: es-data
mountPath: /usr/share/elasticsearch/data
volumeClaimTemplates:
- metadata:
name: es-data
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: Service
metadata:
name: es-cluster-http
labels:
app: es-node
spec:
ports:
- port: 9200
protocol: TCP
name: es-http
selector:
app: es-node
---
apiVersion: v1
kind: Service
metadata:
name: es-cluster-tcp
labels:
app: es-node
spec:
clusterIP: None
selector:
app: es-node
ports:
- port: 9300
protocol: TCP
name: es-tcp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment