kubectl get sc
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
managed-nfs-storage fuseim.pri/ifs Delete Immediate false 3m44s
kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
test-storage-pvc Pending managed-nfs-storage 4m8s
[root@tech04 storageclass]# kubectl logs -f nfs-client-provisioner-7fd8847c4-622c2
I0806 06:24:58.169606 1 leaderelection.go:185] attempting to acquire leader lease default/fuseim.pri-ifs...
E0806 06:25:15.572556 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:"e0920ca3-b276-4afa-9884-104286170948", ResourceVersion:"352783", Generation:0, CreationTimestamp:v1.Time{Time:time.Time{wall:0x0, ext:63763826494, 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-7fd8847c4-622c2_05b0ece9-f67f-11eb-8bc0-126cff951031\",\"leaseDurationSeconds\":15,\"acquireTime\":\"2021-08-06T06:25:15Z\",\"renewTime\":\"2021-08-06T06:25:15Z\",\"leaderTransitions\":1}"}, 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-7fd8847c4-622c2_05b0ece9-f67f-11eb-8bc0-126cff951031 became leader'
I0806 06:25:15.572667 1 leaderelection.go:194] successfully acquired lease default/fuseim.pri-ifs
I0806 06:25:15.572750 1 controller.go:631] Starting provisioner controller fuseim.pri/ifs_nfs-client-provisioner-7fd8847c4-622c2_05b0ece9-f67f-11eb-8bc0-126cff951031!
I0806 06:25:15.673042 1 controller.go:680] Started provisioner controller fuseim.pri/ifs_nfs-client-provisioner-7fd8847c4-622c2_05b0ece9-f67f-11eb-8bc0-126cff951031!
I0806 06:25:17.621598 1 controller.go:987] provision "default/test-storage-pvc" class "managed-nfs-storage": started
E0806 06:25:17.628704 1 controller.go:1004] provision "default/test-storage-pvc" class "managed-nfs-storage": unexpected error getting claim reference: selfLink was empty, can't make reference
selfLink was empty 在k8s集群 v1.20之前都存在,在v1.20之后被删除,需要在/etc/kubernetes/manifests/kube-apiserver.yaml 添加参数
增加 - --feature-gates=RemoveSelfLink=false
spec:
containers:
- command:
- kube-apiserver
- --feature-gates=RemoveSelfLink=false
kubectl apply -f /etc/kubernetes/manifests/kube-apiserver.yaml