问题
昨天我创建了一个新的 kubernetes 集群(v1.20.1,本地),我想添加 NFS 配置。唯一可用(并且仍在维护)的 NFS 配置器似乎是https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner。
它确实说使用您自己的配置器,默认 (quay.io/external_storage/nfs-client-provisioner:latest) 是两年前,但我没有自己的配置器。
当我按照没有 helm 图表的部署指南并检查 nfs-client-provisioner 日志时,我看到以下内容:
I1220 22:20:44.160099 1 leaderelection.go:185attempting to acquire leader lease default/fuseim.pri-ifs...
E1220 22:21:01.598029 1 event.go:259] Could not construct reference to'&v1.Endpoints{TypeMeta:v1.TypeMeta{Kind:"", APIVersion:""}, ObjectMeta:v1.ObjectMeta{Name:"fuseim.pri-ifs", GenerateName:"", Namespace:"default", SelfLink:"", UID:"c852ca40-471f-4019-a099-d72d32555022", ResourceVersion:"134579", Generation:0, CreationTimestamp:v1.Time{Time:time.Time{wall:0x0, ext:63744022156, loc:(*time.Location)(0x1956800)}}, DeletionTimestamp:(*v1.Time)(nil), DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string(nil), Annotations:map[string]string{"control-plane.alpha.kubernetes.io/leader":"{\"holderIdentity\":\"nfs-client-provisioner-5999484954-n4tj7_94db294f-4261-11eb-9b30-c64536689731\",\"leaseDurationSeconds\":15,\"acquireTime\":\"2020-12-20T01:21:01Z\",\"renewTime\":\"2020-12-20T01:21:01Z\",\"leaderTransitions\":2}"}, OwnerReferences:[]v1.OwnerReference(nil), Initializers:(*v1.Initializers)(nil), Finalizers:[]string(nil), ClusterName:""}, Subsets:[]v1.EndpointSubset(nil)}' due to'selfLink was empty, can't make reference'. Will not report event: 'Normal' 'LeaderElection' 'nfs-client-provisioner-5999484954-n4tj7_94db294f-4261-11eb-9b30-c64536689731 became leader'
I1220 22:21:01.598123 1 leaderelection.go:194 successfully acquired lease default/fuseim.pri-ifs
I1220 22:21:01.598198 1 controller.go:631 Starting provisioner controller fuseim.pri/ifs_nfs-client-provisioner-5999484954-n4tj7_94db294f-4261-11eb-9b30-c64536689731!
I1220 22:21:01.709535 1 controller.go:680 Started provisioner controller fuseim.pri/ifs_nfs-client-provisioner-5999484954-n4tj7_94db294f-4261-11eb-9b30-c64536689731!
I1220 22:21:01.717419 1 controller.go:987] provision "default/test-claim" class "managed-nfs-storage" started
E1220 22:21:01.720318 1 controller.go:1004] provision "default/test-claim" class "managed-nfs-storage" unexpected error getting claim reference selfLink was empty, can't make reference
I1220 22:36:01.615073 1 controller.go:987] provision "default/test-claim" class "managed-nfs-storage" started
E1220 22:36:01.618195 1 controller.go:1004] provision "default/test-claim" class "managed-nfs-storage" unexpected error getting claim reference selfLink was empty, can't make reference
原因
您看到此错误是因为:KEP-1164: Deprecate and Remove SelfLink
引用提到的KEP:
在 v1.16 中,我们将通过以下方式弃用 ObjectMeta 和 ListMeta 对象中的 SelfLink 字段:禁用设置 SelfLink 字段并在此功能门后面不透明设置它的逻辑。
在 v1.20(12 个月和 v1.16 的 4 个版本)中,我们将关闭功能门 ,这将自动禁用设置 SelfLinks。但是, 仍然可以通过更改 feature gate的值来恢复行为。
在 v1.21 中,我们将摆脱传播这些字段和字段本身的整个代码。与此同时,我们将检查引用该字段的地方(见下文)并删除这些地方。
如您所见,您可以使用featureGate重新启用它:RemoveSelfLink=false
虽然它没有被推荐并且 SelfLink 将在 v1.21 中被永久删除
也在github上查看这个问题:Using Kubernetes v1.20.0, getting "unexpected error getting claim reference: selfLink was empty, can’t make reference
原文
Kubernetes nfs provider selfLink was empty