apiVersion: apps/v1
kind: Deployment
metadata:
  name: elasticsearch-logging
#  namespace: kube-system
  namespace: logging
  labels:
    k8s-app: elasticsearch-logging
#    kubernetes.io/minikube-addons: efk
#    addonmanager.kubernetes.io/mode: Reconcile
spec:
  replicas: 1
#  selector:
#    k8s-app: elasticsearch-logging
#    addonmanager.kubernetes.io/mode: Reconcile
  selector:
    matchLabels:
      k8s-app: elasticsearch-logging
  template:
    metadata:
      labels:
        k8s-app: elasticsearch-logging
#        addonmanager.kubernetes.io/mode: Reconcile
    spec:
      containers:
      - name: elasticsearch-logging
        image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.3.0
        resources:
          limits:
            cpu: 500m
            memory: 2400Mi
          requests:
            cpu: 100m
            memory: 2350Mi
        ports:
        - containerPort: 9200
          name: db
          protocol: TCP
        - containerPort: 9300
          name: transport
          protocol: TCP
        volumeMounts:
        - name: elasticsearch-logging
          mountPath: /data
        env:
        - name: "NAMESPACE"
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: MINIMUM_MASTER_NODES
          value: "1"
      initContainers:
      - image: registry.hub.docker.com/library/alpine:3.6
        command: ["/sbin/sysctl", "-w", "vm.max_map_count=262144"]
        name: elasticsearch-logging-init
        securityContext:
          privileged: true
      volumes:
      - name: elasticsearch-logging
        emptyDir: {}
