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.
Normal ExternalProvisioning 4m31s (x62 over 19m) persistentvolume-controller waiting for a volume to be created, either by external provisioner "rancher.io/local-path" 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 "local-path-storage/test-pod-pvc-local"
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 "local-path": configuration error, no node was specified
[root@n01-deployer local]#
sc configuration
[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: |
{"apiVersion":"storage.k8s.io/v1","kind":"StorageClass","metadata":{"annotations":{},"name":"local-path"},"provisioner":"rancher.io/local-path","reclaimPolicy":"Delete","volumeBindingMode":"Immediate"}
creationTimestamp: "2022-02-07T16:12:58Z"
name: local-path
resourceVersion: "1501275"
uid: e8060018-e4a8-47f9-8dd4-c63f28eef3f2
provisioner: rancher.io/local-path
reclaimPolicy: Delete
volumeBindingMode: Immediate
PVC configuration
[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
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?
The key to your problem was updating PSP.
I would like to add something about PSP:
According to this documentation and this blog:
As of Kubernetes version 1.21, PodSecurityPolicy (beta) is deprecated. The Kubernetes project aims to shut the feature down in version 1.25.
However I haven't found any information in Rancher's case (the documentation is up to date).
Rancher ships with two default Pod Security Policies (PSPs): the
restricted
andunrestricted
policies.
See also: