简体   繁体   中英

Kubernetes rancher local-path specify node

I have a pod using a pvc. When I start the deployment, the pvc is stuck in the "pending" state, because of a local-path: "configuration error, no node was specified":

Name:          grafana-data
Namespace:     default
StorageClass:  local-path
Status:        Pending
Volume:
Labels:        io.kompose.service=grafana-data
Annotations:   volume.beta.kubernetes.io/storage-provisioner: rancher.io/local-path
               volume.kubernetes.io/storage-provisioner: rancher.io/local-path
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:
Access Modes:
VolumeMode:    Filesystem
Used By:       <none>
Events:
  Type     Reason                Age              From                                                                                                Message
  ----     ------                ----             ----                                                                                                -------
  Normal   Provisioning          8s               rancher.io/local-path_local-path-provisioner-7f68f98c9b-hqf5j_6e774f0a-bb44-4a4e-bfe8-a8781c321cf3  External provisioner is provisioning volume for claim "default/grafana-data"
  Warning  ProvisioningFailed    8s               rancher.io/local-path_local-path-provisioner-7f68f98c9b-hqf5j_6e774f0a-bb44-4a4e-bfe8-a8781c321cf3  failed to provision volume with StorageClass "local-path": configuration error, no node was specified
  Normal   ExternalProvisioning  8s (x2 over 8s)  persistentvolume-controller                                                                         waiting for a volume to be created, either by external provisioner "rancher.io/local-path" or manually created by system administrator

To note is that I previously used volumeBindingMode: WaitForConsumer and it worked there (because it waits for the pod to be scheduled). I understand that when using volumeBindingMode: Immediate (like above) I have to somehow specify the node (because the pod is not scheduled yet). Sadly I haven't figured out a way to specify it.

Based on the warning message failed to provision volume with StorageClass "local-path": configuration error, no node was specified , this may be because of PodSecurityPolicy was not updated to use local-path, which may not allow attaching pvc. Refer to this similar SO & Kube.netes Blog for more information.

Local Path Provisioner: Provides a way for the Kube.netes users to utilize the local storage in each node. Based on the user configuration, the Local Path Provisioner will create either hostPath or local based persistent volume on the node automatically. It utilizes the features introduced by Kube.netes Local Persistent Volume feature, but makes it a simpler solution than the built-in local volume feature in Kube.netes. Please go through Local Path Provisioner for more information.

Edit:

Refer to How Rancher's Local Path Provisioner works blog for more info.

Alternate solution: Migrate from PodSecurityPolicy to the Built-In PodSecurity Admission Controller for more info.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM