I specified:
apiVersion: apps/v1beta1
kind: Deployment
...
volumeMounts:
- name: volumepath
mountPath: /data
ports:
- containerPort: 9200
name: http
protocol: TCP
volumes:
- name: volumepath
persistentVolumeClaim:
claimName: pv-delay-bind
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-delay-bind
spec:
accessModes:
- ReadWriteOnce
capacity:
storage: 10Gi
hostPath:
path: /data/
type: DirectoryOrCreate
storageClassName: default1a
A Persistent Volume is different from a Persistent Volume Claim. Typically, when you use persistent volume claim you are using dynamic provisioning.
So you would need to define the persistent volume claim first and the volume should be created automatically.
First, delete your volume if you don't need it.
$ kubectl delete volume pv-delay-bind
Then create the claim:
$ echo '
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pv-delay-bind
spec:
accessModes:
- ReadWriteOnce
capacity:
storage: 10Gi
storageClassName: default1a' | kubectl apply -f -