The error log is as follows:
1
2
3
4
5
6
7
|
I0620 07:19:39.552037 1 leaderelection.go:185] attempting to acquire leader lease cephfs/ceph.com-cephfs...
E0620 07:19:39.610071 1 event.go:259] Could not construct reference to: '&v1.Endpoints{TypeMeta:v1.TypeMeta{Kind:"", APIVersion:""}, ObjectMeta:v1.ObjectMeta{Name:"ceph.com-cephfs", GenerateName:"", Namespace:"cephfs", SelfLink:"", UID:"4f4ead7b-c097-4074-b56c-76c6888ceed7", ResourceVersion:"209907", Generation:0, CreationTimestamp:v1.Time{Time:time.Time{wall:0x0, ext:63791306379, loc:(*time.Location)(0x19b4b00)}}, DeletionTimestamp:(*v1.Time)(nil), DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string(nil), Annotations:map[string]string{"control-plane.alpha.kubernetes.io/leader":"{\"holderIdentity\":\"cephfs-provisioner-688cc75-xgd5g_58e8a7a6-f069-11ec-aba4-c627c8b0022e\",\"leaseDurationSeconds\":15,\"acquireTime\":\"2022-06-20T07:19:39Z\",\"renewTime\":\"2022-06-20T07:19:39Z\",\"leaderTransitions\":0}"}, 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' 'cephfs-provisioner-688cc75-xgd5g_58e8a7a6-f069-11ec-aba4-c627c8b0022e became leader'
I0620 07:19:39.610143 1 leaderelection.go:194] successfully acquired lease cephfs/ceph.com-cephfs
I0620 07:19:39.610187 1 controller.go:631] Starting provisioner controller ceph.com/cephfs_cephfs-provisioner-688cc75-xgd5g_58e8a7a6-f069-11ec-aba4-c627c8b0022e!
I0620 07:19:39.710456 1 controller.go:680] Started provisioner controller ceph.com/cephfs_cephfs-provisioner-688cc75-xgd5g_58e8a7a6-f069-11ec-aba4-c627c8b0022e!
I0620 07:20:00.618780 1 controller.go:987] provision "default/cephfs-abcdocker" class "cephfs": started
E0620 07:20:00.624863 1 controller.go:1004] provision "default/cephfs-abcdocker" class "cephfs": unexpected error getting claim reference: selfLink was empty, can't make reference
|
When we use ceph csi, the cephfs has been created and the storageclass has been created. The error prompted when pvc applies pvc via sc.
Solution
Prior to Kubernetes 1.24, this could be solved by the following method. but from version 1.24.0, the following parameters are no longer available. The exact solution needs to be updated by ceph.
1
2
3
4
|
# The configuration file needs to be added to all apiserver nodes (master nodes)
[root@k8s-01 ~]# vim /etc/kubernetes/manifests/kube-apiserver.yaml
# Add parameters
- --feature-gates=RemoveSelfLink=false
|
apiserver component is a static Pod, it will restart Apiserver automatically after changing the configuration file.
After modifying all apiserver nodes, you need to check if the nodes have any abnormalities. It is recommended to modify them one by one.
1
2
3
4
|
[root@k8s-01 ~]# kubectl get pod -n kube-system |grep api
kube-apiserver-k8s-01 1/1 Running 0 5m15s
kube-apiserver-k8s-02 1/1 Running 0 38s
kube-apiserver-k8s-03 1/1 Running 0 17s
|