I followed this page [1] to set up nfs with my k8s 1.25.
However the nfs client provisioner is too old and deprecated.
When creating a pvc, it is always pending.
Checking the provisioner log, it is complaining about selfLink being empty.
E0331 06:53:31.562497 1 controller.go:1004] provision "controller-myk8scloud/storage-controller-0" class "default": unexpected error getting claim reference: selfLink was empty, can't make reference
This issue [2] suggests we can fix that by adding "--feature-gates=RemoveSelfLink=false" to apiserver.
But the value RemoveSelfLink is always true from 1.24 [3][4] and can't be set to false.
So according to some comments of [2] I changed to "gcr.io/k8s-staging-sig-storage/nfs-subdir-external-provisioner:v4.0.0", which fixed the issue.
It seems nfs-subdir-external-provisioner is the replacement of nfs-client-provisioner [5]
My deployment looks like [6], and my storage class is like [7].
Please update templates/nfs-provisioner.yaml to use the new nfs-subdir-external-provisioner for k8s 1.24+.
解决办法:
- 1.23之前可以关闭selfLink的方式
- 1.24a之后更换镜像版本解决:
gcr.io/k8s staging sig-storage/nfs-subdir external provisioner:v4.0.0