apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: es7-master
spec:
  replicas: 1
  serviceName: es7-master
  selector:
    matchLabels:
      application: es7
      role: master
  template:
    metadata:
      labels:
        application: es7
        role: master
    spec:
      securityContext:
        fsGroup: 1000
      containers:
      - name: elasticsearch
        resources:
          requests:
            memory: 600Mi
            cpu: 100m
          limits:
            memory: 600Mi
            cpu: 100m
        image: "docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2"
        env:
        - name: "node.name"
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: "ES_JAVA_OPTS"
          value: "-Xmx400m -Xms400m"
        - name: node.master
          value: "true"
        - name: node.data
          value: "false"
        readinessProbe:
          initialDelaySeconds: 15
          httpGet:
            scheme: HTTP
            path: /_cluster/health?local=true
            port: 9200
        ports:
        - containerPort: 9200
          name: es-http
        - containerPort: 9300
          name: es-transport
        volumeMounts:
        - name: data
          mountPath: /usr/share/elasticsearch/data
        - name: config
          mountPath: /usr/share/elasticsearch/config/elasticsearch.yml
          subPath: elasticsearch.yml
      volumes:
      - name: data
        emptyDir: {}
      - name: config
        configMap:
          name: es7-config
          items:
          - key: elasticsearch.yml
            path: elasticsearch.yml
