rimusz / hostpath-provisioner

Dynamic Provisioning of Kubernetes HostPath Volumes
Apache License 2.0
52 stars 22 forks source link

Problem with k8s 1.20.0 #8

Closed tbnguyen1407 closed 3 years ago

tbnguyen1407 commented 3 years ago

Problem

Provisioner fails to provision for PVC on k8s 1.20.0, probably due to using deprecated API

I1222 08:35:34.516087       1 leaderelection.go:187] attempting to acquire leader lease  kube-system/hostpath...
E1222 08:35:34.527970       1 event.go:259] Could not construct reference to: '&v1.Endpoints{TypeMeta:v1.TypeMeta{Kind:"", APIVersion:""}, ObjectMeta:v1.ObjectMeta{Name:"hostpath", GenerateName:"", Namespace:"kube-system", SelfLink:"", UID:"c60ee6c6-8865-4b6b-96a3-fcccfadadc4f", ResourceVersion:"507", Generation:0, CreationTimestamp:v1.Time{Time:time.Time{wall:0x0, ext:63744222934, loc:(*time.Location)(0x1d6f9e0)}}, DeletionTimestamp:(*v1.Time)(nil), DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string(nil), Annotations:map[string]string{"control-plane.alpha.kubernetes.io/leader":"{\"holderIdentity\":\"hostpath-provisioner-fb7b56c97-xnn84_a8bf3c14-4430-11eb-905e-f69a64d714c5\",\"leaseDurationSeconds\":15,\"acquireTime\":\"2020-12-22T08:35:34Z\",\"renewTime\":\"2020-12-22T08:35:34Z\",\"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' 'hostpath-provisioner-fb7b56c97-xnn84_a8bf3c14-4430-11eb-905e-f69a64d714c5 became leader'
I1222 08:35:34.528054       1 leaderelection.go:196] successfully acquired lease kube-system/hostpath
I1222 08:35:34.602606       1 controller.go:571] Starting provisioner controller hostpath_hostpath-provisioner-fb7b56c97-xnn84_a8bf3c14-4430-11eb-905e-f69a64d714c5!
I1222 08:35:34.702851       1 controller.go:620] Started provisioner controller hostpath_hostpath-provisioner-fb7b56c97-xnn84_a8bf3c14-4430-11eb-905e-f69a64d714c5!

Related issue

https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner/issues/25

Workaround

Disable deprecation of feature in kube-apiserver-arg

- --feature-gates=RemoveSelfLink=false
nosmicek commented 3 years ago

have the same problem, proposed workaround worked for me.. is there any planned work to fix this issue?

mbentley commented 3 years ago

Looks like other projects (probably based on the same original code) are running into similar issues: https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner/issues/25 and someone even has already submitted a PR to fix the NFS provisioner https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner/pull/26. If I wasn't completely inept at go, I'd give it a shot.

hcsaustrup commented 3 years ago

The fix doesn't seem to have any effect on v1.20.2. I believe it only worked with 1.20.0 :-/ Please fix :-)

tbnguyen1407 commented 3 years ago

The fix doesn't seem to have any effect on v1.20.2. I believe it only worked with 1.20.0 :-/ Please fix :-)

I am on 1.20.2 and the workaround seems to be working still.

morganchristiansson commented 3 years ago

I might try k3s 1.21 - any idea if workaround will still work?

The feature gate has no until version in docs https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/ so should be OK?

tbnguyen1407 commented 3 years ago

I tried with k3s 1.21. The workaround is still working.