apiVersion: v1
kind: PersistentVolume
metadata:
  name: elasticsearch-data-pv0
  labels:
    app: elasticsearch-k8s
spec:
  capacity:
    storage: 5Gi
  volumeMode: Filesystem
  accessModes:
  - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  storageClassName: local-storage
  # local:
  #   path: /opt/elasticsearch/data0
  hostPath:
    path: /opt/elasticsearch/data0
    type: DirectoryOrCreate
  nodeAffinity:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: node-role.kubernetes.io/master
          operator: Exists
