<p>We are trying to configure local-storage in Rancher and storage provisioner configured successfully.
But when I create pvc using local-storage sc its going in pending state with below error.</p>
<pre><code>   Normal   ExternalProvisioning  4m31s (x62 over 19m)  persistentvolume-controller                                                                         waiting for a volume to be created, either by external provisioner &quot;rancher.io/local-path&quot; or manually created by system administrator
  Normal   Provisioning          3m47s (x7 over 19m)   rancher.io/local-path_local-path-provisioner-5f8f96cb66-8s9dj_f1bdad61-eb48-4a7a-918c-6827e75d6a27  External provisioner is provisioning volume for claim &quot;local-path-storage/test-pod-pvc-local&quot;
  Warning  ProvisioningFailed    3m47s (x7 over 19m)   rancher.io/local-path_local-path-provisioner-5f8f96cb66-8s9dj_f1bdad61-eb48-4a7a-918c-6827e75d6a27  failed to provision volume with StorageClass &quot;local-path&quot;: configuration error, no node was specified
[root@n01-deployer local]#
</code></pre>
<p>sc configuration</p>
<pre><code>[root@n01-deployer local]# kubectl edit  sc local-path
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {&quot;apiVersion&quot;:&quot;storage.k8s.io/v1&quot;,&quot;kind&quot;:&quot;StorageClass&quot;,&quot;metadata&quot;:{&quot;annotations&quot;:{},&quot;name&quot;:&quot;local-path&quot;},&quot;provisioner&quot;:&quot;rancher.io/local-path&quot;,&quot;reclaimPolicy&quot;:&quot;Delete&quot;,&quot;volumeBindingMode&quot;:&quot;Immediate&quot;}
  creationTimestamp: &quot;2022-02-07T16:12:58Z&quot;
  name: local-path
  resourceVersion: &quot;1501275&quot;
  uid: e8060018-e4a8-47f9-8dd4-c63f28eef3f2
provisioner: rancher.io/local-path
reclaimPolicy: Delete
volumeBindingMode: Immediate
</code></pre>
<p>PVC configuration</p>
<pre><code>[root@n01-deployer local]# cat pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  namespace: local-path-storage
  name: test-pod-pvc-local-1

spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: local-path
  resources:
    requests:
      storage: 5Gi
  volumeMode: Filesystem
 
</code></pre>
<p>I have mounted the local volume in all the worker node still my pvc not getting created. Can some please help me solve this issue?</p>

<p>The key to your problem was updating PSP.</p>
<p>I would like to add something about PSP:</p>
<p>According to <a href="https://cloud.google.com/kubernetes-engine/docs/deprecations/podsecuritypolicy" rel="nofollow noreferrer">this documentation</a> and <a href="https://kubernetes.io/blog/2021/04/06/podsecuritypolicy-deprecation-past-present-and-future/" rel="nofollow noreferrer">this blog</a>:</p>
<blockquote>
<p>As of Kubernetes  <strong>version 1.21</strong>, PodSecurityPolicy (beta) is deprecated. The Kubernetes project aims to shut the feature down in  <strong>version 1.25</strong>.</p>
</blockquote>
<p>However I haven't found any information in Rancher's case (the documentation is up to date).</p>
<blockquote>
<p>Rancher ships with two default Pod Security Policies (PSPs): the <code>restricted</code> and <code>unrestricted</code> policies.</p>
</blockquote>
<hr />
<p>See also:</p>
<ul>
<li><a href="https://codilime.com/blog/the-benefits-of-pod-security-policy-a-use-case/" rel="nofollow noreferrer"><em>The benefits of Pod Security Policy</em></a></li>
<li><a href="https://docs.bitnami.com/tutorials/secure-kubernetes-cluster-psp/" rel="nofollow noreferrer"><em>Secure Kubernetes cluster PSP</em></a></li>
<li><a href="https://rancher.com/docs/rancher/v2.6/en/cluster-admin/pod-security-policies/" rel="nofollow noreferrer"><em>Pod Security Policies</em></a></li>
</ul>
