NFS Persistent Volume Claim 无限期挂起

Posted

技术标签:

【中文标题】NFS Persistent Volume Claim 无限期挂起【英文标题】:NFS Persistent Volume Claim remains pending indefinitely 【发布时间】:2018-11-29 23:00:41 【问题描述】:

我在创建 PVC 时收到以下错误,但我不知道这是什么意思。

Events:
  Type    Reason             Age              From           Message
  ----    ------             ----             ----           -------
  Normal  ExternalExpanding  1m (x3 over 5m)  volume_expand  Ignoring the PVC: didn't find a plugin capable of expanding the volume; waiting for an external
controller to process this PVC.

我的 PV 在那里,似乎很好。

这是我的 PV 和 PVC 的规格。

apiVersion: v1
kind: PersistentVolume
metadata:
  creationTimestamp: null
  finalizers:
  - kubernetes.io/pv-protection
  labels:
    app: projects-service
    app-guid: design-center-projects-service
    asset: service
    chart: design-center-projects-service
    class: projects-service-nfs
    company: mulesoft
    component: projects
    component-asset: projects-service
    heritage: Tiller
    product: design-center
    product-component: design-center-projects
    release: design-center-projects-service
  name: projects-service-nfs
  selfLink: /api/v1/persistentvolumes/projects-service-nfs
spec:
  accessModes:
  - ReadWriteOnce
  capacity:
    storage: 30Gi
  claimRef:
    apiVersion: v1
    kind: PersistentVolumeClaim
    name: projects-service-nfs-block
    namespace: design-center
    resourceVersion: "7932052"
    uid: d114dd38-f411-11e8-b7b1-1230f683f84a
  mountOptions:
  - nfsvers=3
  - hard
  - sync
  nfs:
    path: /
    server: 1.1.1.1
  persistentVolumeReclaimPolicy: Retain
  volumeMode: Block
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  creationTimestamp: null
  finalizers:
  - kubernetes.io/pvc-protection
  labels:
    app: projects-service
    app-guid: design-center-projects-service
    asset: service
    chart: design-center-projects-service
    company: mulesoft
    component: projects
    component-asset: projects-service
    example: test
    heritage: Tiller
    product: design-center
    product-component: design-center-projects
    release: design-center-projects-service
  name: projects-service-nfs-block
  selfLink: /api/v1/namespaces/design-center/persistentvolumeclaims/projects-service-nfs-block
spec:
  accessModes:
  - ReadWriteOnce
  dataSource: null
  resources:
    requests:
      storage: 20Gi
  selector:
    matchLabels:
      class: projects-service-nfs
  storageClassName: ""
  volumeMode: Block
  volumeName: projects-service-nfs

版本:

$ kubectl version
Client Version: version.InfoMajor:"1", Minor:"11", GitVersion:"v1.11.2", GitCommit:"bb9ffb1654d4a729bb4cec18ff088eacc153c239", GitTreeState:"clean", BuildDate:"2018-08-08T16:31:10Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"darwin/amd64"
Server Version: version.InfoMajor:"1", Minor:"12", GitVersion:"v1.12.1", GitCommit:"4ed3216f3ec431b140b1d899130a69fc671678f4", GitTreeState:"clean", BuildDate:"2018-10-05T16:36:14Z", GoVersion:"go1.10.4", Compiler:"gc", Platform:"linux/amd64"

【问题讨论】:

【参考方案1】:

看起来你在某个时候updated/expanded the PVC?这是调用:

func (expc *expandController) pvcUpdate(oldObj, newObj interface)
...

在函数中它试图找到一个插件进行扩展,但找不到它:

volumePlugin, err := expc.volumePluginMgr.FindExpandablePluginBySpec(volumeSpec)
if err != nil || volumePlugin == nil 
    err = fmt.Errorf("didn't find a plugin capable of expanding the volume; " +
        "waiting for an external controller to process this PVC")
    ...
    return

如果您看到此document,则表明以下卷类型支持使用树内插件进行 PVC 扩展:AWS-EBS、GCE-PD、Azure Disk、Azure File、Glusterfs、Cinder、Portworx 和 Ceph RBD。所以 NFS 不是其中之一,这就是您看到该事件的原因。看起来将来可能会支持它,或者也可以通过自定义插件支持它。

如果您尚未更新 PVC,我建议您使用与 here 所述相同的 PV 和 PVC 容量

【讨论】:

那么在PVC更新之后,接下来要怎么解决这个问题呢? 会是什么问题?数量待定?你检查事件了吗? 我所做的是编辑 PVC 并移除终结器保护。之后就可以删除 PVC。 是的,终结器会阻止删除

以上是关于NFS Persistent Volume Claim 无限期挂起的主要内容,如果未能解决你的问题,请参考以下文章

docker volume nfs 权限被拒绝

docker volume 创建使用备份使用nfs存储

k8s 使用NFS的Volume

K8S 之 使用NFS卷作为POD存储卷

"三剑客”之Swarm应用数据持久化管理(volume bind nfs)

Esxi6.0系统挂载NFS文件系统