I have tried kubectl apply
on this file:
apiVersion: v1
kind: PersistentVolume
metadata:
name: app-pv
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 1Gi
accessModes:
- ReadWriteMany
hostPath:
path: /app
nodeAffinity:
required:
nodeSelectorTerms:
- matchFields:
- key: metadata.labels.node-role.kubernetes.io/master
operator: NotIn
values:
- ""
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: default-app-pvc
spec:
storageClassName: manual
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1Gi
But I get:
The PersistentVolume "app-pv" is invalid: spec.nodeAffinity.required.nodeSelectorTerms[0].matchFields[0].key: Invalid value: "metadata.labels.node-role.kubernetes.io/master": not a valid field selector key