Kubernetes Hostpath External Provisioner - PVC Pending Kubernetes Hostpath External Provisioner - PVC Pending kubernetes kubernetes

Kubernetes Hostpath External Provisioner - PVC Pending


I have figured out the issue.. Thanks @jaxxstorm for helping me move towards in the right direction.

When I inspected provisioner pod logs I could see that its unable to access the API server to list StorageClass, PVC or PVs as it was created with default service account, which does not have the privileges to access these APIs.

The solution was to create a separate service account, pod security policy, cluster role and cluster role binding, as explained for NFS external provisioner here

After this I could see my PVC getting binded to the volume and hostpath showing the mount

[root@umeshworkstation hostpath-provisioner]# kubectl get pvcNAME       STATUS    VOLUME                                     CAPACITY   ACCESSMODES   STORAGECLASS       AGEhostpath   Bound     pvc-8179c8d6-36db-11e7-9ed4-005056a21a50   1Mi        RWX           example-hostpath   1m[root@umeshworkstation hostpath-provisioner]# ls /tmp/hostpath-provisioner/pvc-8179c8d6-36db-11e7-9ed4-005056a21a50