apiVersion: apps/v1
kind: DaemonSet
metadata:
  namespace: kube-system
  name: es-data
  labels:
    plugin: elasticsearch-logging  
    component: elasticsearch
    role: data
spec:
  selector:
    matchLabels:
      plugin: elasticsearch-logging    
      component: elasticsearch
      role: data 
  template:
    metadata:
      labels:
        plugin: elasticsearch-logging
        component: elasticsearch
        role: data
    spec:
      serviceAccount: elasticsearch-logging
      nodeSelector:
        "kube-system/es-node": "true"
      tolerations:
      - effect: NoSchedule
        key: node-role.tenxcloud.com/es
      containers:
      - name: es-data
        securityContext:
          privileged: false
          capabilities:
            add:
              - IPC_LOCK
              - SYS_RESOURCE
        image: 10.5.79.237/system_containers/docker-elasticsearch-kubernetes:5.6.0
        imagePullPolicy: Always
        env:
        - name: NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: NODE_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: "CLUSTER_NAME"
          value: "es-cluster"
        - name: NODE_MASTER
          value: "false"
        - name: NODE_DATA
          value: "true"       
        - name: NODE_INGEST
          value: "false"
        - name: HTTP_ENABLE
          value: "false"
        - name: "ES_JAVA_OPTS"
          value: "-Xms16g -Xmx16g -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap"
        ports:
        - containerPort: 9300
          name: transport
          protocol: TCP
        resources:
          requests:
            cpu: 4
            memory: 20Gi
          limits:
            cpu: 4
            memory: 20Gi
        volumeMounts:
        - name: storage
          mountPath: /data
      volumes:
        - name: "storage"
          hostPath:
            path: /nas/es_data

