apiVersion: apps/v1
kind: Deployment

metadata:
  name: elasticsearch
  namespace: monitoring

spec:
  replicas: 1
  selector:
    matchLabels:
      app: elasticsearch

  template:
    metadata:
      labels:
        app: elasticsearch

    spec:
      containers:
        - name: elasticsearch
          image: elasticsearch:7.7.0
          ports:
            - name: elasticsearch
              containerPort: 9200
          resources:
            requests:
              cpu: 50m
              memory: 100Mi
            limits:
              cpu: 100m
              memory: 200Mi
          volumeMounts:
            - mountPath: /data
              name: elasticsearch-pvc
            - mountPath: /usr/share/elasticsearch/config
              name: elasticsearch-config
      volumes:
        - name: elasticsearch-pvc
          persistentVolumeClaim:
            claimName: elasticsearch
        - name: elasticsearch-config
          configMap:
            name: elasticsearch
