Pod has unbound immediate PersistentVolumeClaims

Yes! You can do something like this:

cat <<EOF | kubectl apply -f -
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
  name: quickstart
spec:
  version: 7.6.1
  nodeSets:
  - name: default
    count: 1
    config:
      node.master: true
      node.data: true
      node.ingest: true
      node.store.allow_mmap: false
    volumeClaimTemplates:
    - metadata:
        name: elasticsearch-data
      spec:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 500Gi
        storageClassName: ssd
EOF

You should figure out what's the best storage class depending on your use case. Network-attached storage generally provides simpler operations (volumes can be moved from one host to another), but poorer performance when compared to local storage.

1 Like