apiVersion: apps/v1
kind: Deployment
metadata:
  name: elasticsearch
  labels:
    app: elasticsearch
spec:
  replicas: 1
  selector:
    matchLabels:
      app: elasticsearch
  template:
    metadata:
      labels:
        app: elasticsearch
    spec:
      containers:
        - name: elasticsearch
          image: elasticsearch:8.1.2
          env:
            - name: ES_JAVA_OPTS
              value: -Xmx256m -Xms256m
            - name: discovery.type
              value: single-node
          resources: {}
          volumeMounts:
            - mountPath: /usr/share/elasticsearch/data
              name: elasticsearch
      restartPolicy: Always
      volumes:
        - name: elasticsearch
          hostPath:
            path: /var/k8s/volumes/default/elasticsearch
