When I try to create an nfs-based persistent volume in our local kubernetes cluster, I get the following error:
# kubectl create -f nfs.yaml
error: error validating "nfs.yaml": error validating data: the server could not find the requested resource; if you choose to ignore these errors, turn validation off with --validate=false
The nfs.yaml
has the following content:
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-nfs-pv1
labels:
type: nfs
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteMany
nfs:
server: 192.168.1.3
path: "/srv/kubedata/"
The kubernetes cluster runs on three virtual machines created in our local openstack cloud (installed with kubespray). The nfs share is on the first node, and could be mounted manually on all nodes.
How can I fix this problem? Is the problem in the yaml file? How can I diagnose the problem? It would be very helpful to know where exactly the error is: is there a debug mode for kubectl?
Update: The original yaml I posted was corrupt, but that was because the stack overflow quote algorithm ate some newlines. I fixed that, now the posted yaml seems to validate on https://kubeyaml.com/, so the yaml seems to be okay (syntax-wise, at least).
Update2:
# kubectl version
Client Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.0", GitCommit:"fff5156092b56e6bd60fff75aad4dc9de6b6ef37", GitTreeState:"clean", BuildDate:"2017-03-28T16:36:33Z", GoVersion:"go1.7.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.3", GitCommit:"2d3c76f9091b6bec110a5e63777c332469e0cba2", GitTreeState:"clean", BuildDate:"2019-08-19T11:05:50Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}