Joseph Hwang
Joseph Hwang

Reputation: 1421

The server could not find the requested resource when generating Kubernetes Persistent Volume

I use minikube on windows 10 and try to generate Persistent Volume with minikube dashboard. Belows are my PV yaml file contents.

apiVersion: v1
kind: PersistentVolume 
metadata:
  name: blog-pv
  labels:
    type: local
spec:
  storageClassName: manual
  capacity:
    storage: 1Gi
  volumeMode: Filesystem
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Recycle
  hostPath:
    path: "/mnt/data"

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: blog-pv-claim
spec:
  storageClassName: manual
  volumeName: blog-pv
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 500Mi

But minikube dashboard throw the following errors.

## Deploying file has failed
the server could not find the requested resource

But I can generate PV with kubectl command as executing the following command

kubectl apply -f pod-pvc-test.yaml

For your information, the version of kubectl.exe is

Client Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.0", GitCommit:"70132b0f130acc0bed193d9ba59dd186f0e634cf", GitTreeState:"clean", BuildDate:"2019-12-07T21:20:10Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.2", GitCommit:"59603c6e503c87169aea6106f57b9f242f64df89", GitTreeState:"clean", BuildDate:"2020-01-18T23:22:30Z", GoVersion:"go1.13.5", Compiler:"gc", Platform:"linux/amd64"}

How can I generate the Persistent Volume with minikube dashboard as well as kubectl command?

== Updated Part==

> kubectl get pv
NAME      CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                   STORAGECLASS   REASON   AGE
blog-pv   1Gi        RWO            Recycle          Bound    default/blog-pv-claim   manual                  5m1s

Upvotes: 0

Views: 1369

Answers (2)

Nick
Nick

Reputation: 1948

I've managed to reproduce the issue you've been describing on my minikube with the v2.0.0-beta8 dashboard.

$ minikube version
minikube version: v1.9.1

$ kubectl version
Client Version: GitVersion:"v1.17.4"
Server Version: GitVersion:"v1.18.0"

Please note that the offical guide reffers to v2.0.0-beta8 which is broken :).

Recently there were some fixes for the broken functionality (they'd been merged to master branch).

Please update the version of the dashboard to at least the v2.0.0-rc6.

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-rc6/aio/deploy/recommended.yaml

I was able successfully creating PV and PVC (via dashboard) from yaml provided.

Hope that helps!

Upvotes: 1

BMW
BMW

Reputation: 45253

First, apply the resource one by one. So make sure this problem can be isolated to PV(PersistentVolume) or PVC (PersistentVolumeClaim)

Second, please adjust the hostPath to others, /mnt/data normally is a mounted or NFS folder, maybe that's the issue, you can adjust to some other real path for testing.

After you applied them, please show the output

kubectl get pv,pvc

You should be fine to know the root cause now.

Upvotes: 1

Related Questions