牧场主中的本地存储供应商不创建 PVC

local storage-provisioner in rancher not creating the pvc

我们正在尝试在 Rancher 中配置本地存储,并且已成功配置存储供应器。 但是当我使用 local-storage sc 创建 pvc 时,它进入挂起状态并出现以下错误。

   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配置

[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配置

[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
 

我已经在所有工作节点中安装了本地卷,但我的 pvc 仍未创建。有人可以帮我解决这个问题吗?

问题的关键在于更新 PSP。

我想补充一些关于 PSP 的内容:

根据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.

但是我没有在 Rancher 的案例中找到任何信息(文档是最新的)。

Rancher ships with two default Pod Security Policies (PSPs): the restricted and unrestricted policies.


另请参阅: