Last active
November 8, 2018 07:34
-
-
Save Thakurvaibhav/efb0670d1f66dbc215b448c2729edd6e to your computer and use it in GitHub Desktop.
Elasticsearch Master Node Deployment and Headless Service
This file contains 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: Namespace | |
metadata: | |
name: elasticsearch | |
--- | |
apiVersion: apps/v1beta1 | |
kind: Deployment | |
metadata: | |
name: es-master | |
namespace: elasticsearch | |
labels: | |
component: elasticsearch | |
role: master | |
spec: | |
replicas: 3 | |
template: | |
metadata: | |
labels: | |
component: elasticsearch | |
role: master | |
spec: | |
affinity: | |
podAntiAffinity: | |
preferredDuringSchedulingIgnoredDuringExecution: | |
- weight: 100 | |
podAffinityTerm: | |
labelSelector: | |
matchExpressions: | |
- key: role | |
operator: In | |
values: | |
- master | |
topologyKey: kubernetes.io/hostname | |
initContainers: | |
- name: init-sysctl | |
image: busybox:1.27.2 | |
command: | |
- sysctl | |
- -w | |
- vm.max_map_count=262144 | |
securityContext: | |
privileged: true | |
containers: | |
- name: es-master | |
image: quay.io/pires/docker-elasticsearch-kubernetes:6.2.4 | |
env: | |
- name: NAMESPACE | |
valueFrom: | |
fieldRef: | |
fieldPath: metadata.namespace | |
- name: NODE_NAME | |
valueFrom: | |
fieldRef: | |
fieldPath: metadata.name | |
- name: CLUSTER_NAME | |
value: my-es | |
- name: NUMBER_OF_MASTERS | |
value: "2" | |
- name: NODE_MASTER | |
value: "true" | |
- name: NODE_INGEST | |
value: "false" | |
- name: NODE_DATA | |
value: "false" | |
- name: HTTP_ENABLE | |
value: "false" | |
- name: ES_JAVA_OPTS | |
value: -Xms256m -Xmx256m | |
- name: PROCESSORS | |
valueFrom: | |
resourceFieldRef: | |
resource: limits.cpu | |
resources: | |
limits: | |
cpu: 2 | |
ports: | |
- containerPort: 9300 | |
name: transport | |
volumeMounts: | |
- name: storage | |
mountPath: /data | |
volumes: | |
- emptyDir: | |
medium: "" | |
name: "storage" | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: elasticsearch-discovery | |
namespace: elasticsearch | |
labels: | |
component: elasticsearch | |
role: master | |
spec: | |
selector: | |
component: elasticsearch | |
role: master | |
ports: | |
- name: transport | |
port: 9300 | |
protocol: TCP | |
clusterIP: None | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment