rimusz / charts

Helm Charts for Kubernetes
MIT License
90 stars 70 forks source link

hostpath-provisioner: unexpected error getting claim reference: selfLink was empty, can't make reference #113

Closed dreyTee closed 3 years ago

dreyTee commented 3 years ago

Is this a request for help?: yes


Is this a BUG REPORT or FEATURE REQUEST? (choose one): BugReport

Version of Helm and Kubernetes: k8s: 1.21.3 helm: 3.6.3

Which chart: hostpath-provisioner

What happened: Provisioner doesn't provision PVs:

I0901 10:41:21.403079       1 controller.go:926] provision "local-ns/s3" class "SomeName": started
E0901 10:41:21.410537       1 controller.go:943] provision "local-ns/s3" class "SomeName": unexpected error getting claim reference: selfLink was empty, can't make reference

Googled and found similar issue in nfs provisioner (https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner/issues/25). k8s from v1.20.0 changed default behaviour and started using RemoveSelfLink=true Workaround for kube-apiserver was to pass --feature-gates=RemoveSelfLink=false as argument or load via kubectl apply -f. It worked until k8s v1.21.0 Now I can't make hostpath-provisioner work with kind cluster.

What you expected to happen: Provisioner should provision PVs.

How to reproduce it (as minimally and precisely as possible): 1) start kind cluster with default settings 2) helm install hostpath-provisioner (any way of installation could be used, use --set storageClass.name="SomeName") 3) add a PVC request for a storage class "SomeName"

Anything else we need to know: Any help will be appreciated.

rimusz commented 3 years ago

I'm not sure how I can help here as it is based on kubernetes-sigs/sig-storage-lib-external-provisioner/hostpath-provisioner example project which wasn't updated for the last 3 years except the go version

tuananhnguyen-ct commented 3 years ago

@rimusz it might be related to https://github.com/rimusz/hostpath-provisioner/issues/8 which I'm taking a look into.

rimusz commented 3 years ago

@tuananhnguyen-ct please try tag v0.2.5 I have built it for testing on 1.21.x https://github.com/rimusz/hostpath-provisioner/pull/10/commits/c890bee005d0ee475de0d05121f47c3d5bbd070f

rimusz commented 3 years ago

I did run tests on kind:

$ kubectl version --short
Client Version: v1.22.1
Server Version: v1.21.1

$ helm upgrade --install hostpath-provisioner -n hostpath-provisioner center/hostpath-provisioner --set image.tag=v0.2.5
Release "hostpath-provisioner" has been upgraded. Happy Helming!
NAME: hostpath-provisioner
LAST DEPLOYED: Wed Sep  8 14:06:20 2021
NAMESPACE: hostpath-provisioner
STATUS: deployed
REVISION: 2
TEST SUITE: None
NOTES:
The Hostpath Provisioner service has now been installed.

A storage class named 'hostpath' has now been created
and is available to provision dynamic volumes.

You can use this storageclass by creating a `PersistentVolumeClaim` with the
correct storageClassName attribute. For example:

    ---
    kind: PersistentVolumeClaim
    apiVersion: v1
    metadata:
      name: test-dynamic-volume-claim
    spec:
      storageClassName: "hostpath"
      accessModes:
        - ReadWriteOnce
      resources:
        requests:
          storage: 100Mi

$ kubectl apply pvc-test.yaml
persistentvolumeclaim/test-dynamic-volume-claim created

$ kubectl get pvc
NAME                        STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
test-dynamic-volume-claim   Bound    pvc-fd7fc554-c83e-4696-a284-8779e405f381   100Mi      RWO            hostpath       22s

Screenshot 2021-09-08 at 14 10 35

Looking good, I'm going to merge my PR https://github.com/rimusz/hostpath-provisioner/pull/10

rimusz commented 3 years ago

Fixed in #114