apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: logging
  name: elasticsearch
  labels:
    app: elasticsearch
spec:
  selector:
    matchLabels:
      app: elasticsearch
  template:
    metadata:
      labels:
        app: elasticsearch
    spec:
      containers:
        - name: elasticsearch
          image: docker.elastic.co/elasticsearch/elasticsearch:7.2.0
          env:
            - name: discovery.type
              value: single-node
          resources:
            requests:
              memory: "10Gi"
              cpu: "2"
            limits:
              memory: "10Gi"
              cpu: "2"    
          ports:
            - containerPort: 9200
              protocol: TCP
          volumeMounts:
            - name: data
              mountPath: /var/lib/elasticsearch
      volumes:
        - name: data
          persistentVolumeClaim:
            claimName: elasticsearch