apiVersion: v1
kind: PersistentVolume
metadata:
  name: data-pv0
  labels:
    volume: elastic-volume
spec:
  storageClassName: local
  capacity:
    storage: 20Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  claimRef:
    namespace: default
    name: elasticsearch-data-elasticsearch-demo-es-default-0
  hostPath:
    path: /opt/elasticsearch
    type: DirectoryOrCreate
  nodeAffinity:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: kubernetes.io/hostname
          operator: In
          values:
          - k8s-1