Skip to content

Instantly share code, notes, and snippets.

@arobson
Last active March 18, 2018 03:22
Show Gist options
  • Save arobson/d6e54f1843cf266a19d4def8b5644ce2 to your computer and use it in GitHub Desktop.
Save arobson/d6e54f1843cf266a19d4def8b5644ce2 to your computer and use it in GitHub Desktop.
An Elastic Search Stateful Set and Service Manifest
- apiVersion: v1
kind: Service
metadata:
namespace: infra
name: es
labels:
app: es
name: es
namespace: infra
spec:
selector:
app: elasticsearch
ports:
- name: primary
port: 9200
targetPort: 9200
protocol: TCP
- name: secondary
port: 9300
targetPort: 9300
protocol: TCP
clusterIP: None
- apiVersion: v1
kind: Service
metadata:
namespace: infra
name: elasticsearch
labels:
app: elasticsearch
name: elasticsearch
namespace: infra
spec:
selector:
app: elasticsearch
ports:
- name: primary
port: 9200
targetPort: 9200
protocol: TCP
- name: secondary
port: 9300
targetPort: 9300
protocol: TCP
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
namespace: infra
name: elasticsearch
labels:
name: elasticsearch
namespace: infra
spec:
serviceName: es
replicas: 1
revisionHistoryLimit: 1
updateStrategy:
type: RollingUpdate
selector:
matchLabels:
app: elasticsearch
template:
metadata:
labels:
app: elasticsearch
name: elasticsearch
namespace: infra
spec:
containers:
- name: elasticsearch
image: 'elasticsearch:5.5.1-alpine'
env:
- name: NETWORK_HOST
value: 0.0.0.0
- name: ES_JAVA_OPTS
value: '-Xms256m -Xmx1g'
ports:
- name: primary
containerPort: 9200
protocol: TCP
- name: secondary
containerPort: 9300
protocol: TCP
resources:
requests:
memory: 256Mi
cpu: 10m
limits:
memory: 1024Mi
cpu: 1000m
volumes:
- name: es-config
configMap:
name: es-config
items:
- key: jvm.options
path: jvm.options
volumeClaimTemplates:
- metadata:
name: es-data
namespace: infra
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment