-
-
Save nemmeviu/f25dc5d70231604a8ec1b2df0879ff3b to your computer and use it in GitHub Desktop.
kubernetes stateful elasticsearch cluster
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: es-client | |
labels: | |
app: es-client | |
spec: | |
ports: | |
- port: 9200 | |
name: http | |
targetPort: 9200 | |
selector: | |
app: es-client | |
--- | |
apiVersion: v1 | |
kind: ReplicationController | |
metadata: | |
name: es-client | |
spec: | |
replicas: 1 | |
template: | |
metadata: | |
labels: | |
app: es-client | |
annotations: | |
pod.beta.kubernetes.io/init-containers: '[ | |
{ | |
"name": "sysctl", | |
"image": "busybox", | |
"imagePullPolicy": "IfNotPresent", | |
"command": ["sysctl", "-w", "vm.max_map_count=262144"], | |
"securityContext": { | |
"privileged": true | |
} | |
} | |
]' | |
spec: | |
containers: | |
- name: es-client | |
image: elasticsearch:5.1.1 | |
env: | |
- name: ES_JAVA_OPTS | |
value: -Xms256m -Xmx256m | |
args: | |
- -Ecluster.name=k8s | |
- -Enode.name=${HOSTNAME} | |
- -Ediscovery.zen.ping.unicast.hosts=es-master.default.svc.cluster.local | |
- -Enode.master=false | |
- -Enode.data=false | |
- -Enode.ingest=false | |
ports: | |
- containerPort: 9300 | |
name: transport | |
- containerPort: 9200 | |
name: http | |
volumeMounts: | |
- mountPath: /usr/share/elasticsearch/data | |
name: data-volume | |
volumes: | |
- name: data-volume | |
emptyDir: {} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: es-data | |
labels: | |
app: es-data | |
spec: | |
ports: | |
- port: 9300 | |
name: transport | |
clusterIP: None | |
selector: | |
app: es-data | |
--- | |
apiVersion: apps/v1beta1 | |
kind: StatefulSet | |
metadata: | |
name: es-data | |
spec: | |
serviceName: "es-data" | |
replicas: 1 | |
template: | |
metadata: | |
labels: | |
app: es-data | |
annotations: | |
pod.beta.kubernetes.io/init-containers: '[ | |
{ | |
"name": "sysctl", | |
"image": "busybox", | |
"imagePullPolicy": "IfNotPresent", | |
"command": ["sysctl", "-w", "vm.max_map_count=262144"], | |
"securityContext": { | |
"privileged": true | |
} | |
} | |
]' | |
spec: | |
terminationGracePeriodSeconds: 10 | |
containers: | |
- name: es-data | |
image: elasticsearch:5.1.1 | |
env: | |
- name: ES_JAVA_OPTS | |
value: -Xms256m -Xmx256m | |
args: | |
- -Ecluster.name=k8s | |
- -Enode.name=${HOSTNAME} | |
- -Ediscovery.zen.ping.unicast.hosts=es-master.default.svc.cluster.local | |
- -Enode.master=false | |
- -Enode.data=true | |
- -Enode.ingest=false | |
ports: | |
- containerPort: 9300 | |
name: transport | |
- containerPort: 9200 | |
name: http | |
volumeMounts: | |
- mountPath: /usr/share/elasticsearch/data | |
name: data-volume | |
volumeClaimTemplates: | |
- metadata: | |
name: data-volume | |
annotations: | |
volume.alpha.kubernetes.io/storage-class: anything | |
spec: | |
accessModes: [ "ReadWriteOnce" ] | |
resources: | |
requests: | |
storage: 2Gi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: es-master | |
labels: | |
app: es-master | |
spec: | |
ports: | |
- port: 9300 | |
name: transport | |
clusterIP: None | |
selector: | |
app: es-master | |
--- | |
apiVersion: apps/v1beta1 | |
kind: StatefulSet | |
metadata: | |
name: es-master | |
spec: | |
serviceName: "es-master" | |
replicas: 3 | |
template: | |
metadata: | |
labels: | |
app: es-master | |
annotations: | |
pod.beta.kubernetes.io/init-containers: '[ | |
{ | |
"name": "sysctl", | |
"image": "busybox", | |
"imagePullPolicy": "IfNotPresent", | |
"command": ["sysctl", "-w", "vm.max_map_count=262144"], | |
"securityContext": { | |
"privileged": true | |
} | |
} | |
]' | |
spec: | |
terminationGracePeriodSeconds: 10 | |
containers: | |
- name: es-master | |
image: elasticsearch:5.1.1 | |
env: | |
- name: ES_JAVA_OPTS | |
value: -Xms256m -Xmx256m | |
args: | |
- -Ecluster.name=k8s | |
- -Enode.name=${HOSTNAME} | |
- -Ediscovery.zen.ping.unicast.hosts=es-master.default.svc.cluster.local | |
- -Ediscovery.zen.minimum_master_nodes=2 | |
- -Enode.master=true | |
- -Enode.data=false | |
- -Enode.ingest=false | |
ports: | |
- containerPort: 9300 | |
name: transport | |
- containerPort: 9200 | |
name: http | |
volumeMounts: | |
- mountPath: /usr/share/elasticsearch/data | |
name: data-volume | |
volumeClaimTemplates: | |
- metadata: | |
name: data-volume | |
annotations: | |
volume.alpha.kubernetes.io/storage-class: anything | |
spec: | |
accessModes: [ "ReadWriteOnce" ] | |
resources: | |
requests: | |
storage: 2Gi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment