Kubernetes NFS PersistentVolumeClaim的状态为Pending [英] Kubernetes NFS PersistentVolumeClaim has status Pending

查看:1484
本文介绍了Kubernetes NFS PersistentVolumeClaim的状态为Pending的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Kubernetes集群配置为使用本地NFS服务器存储持久卷.

I am trying to configure my Kubernetes cluster to use a local NFS server for persistent volumes.

我将PersistentVolume设置如下:

I set up the PersistentVolume as follows:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: hq-storage-u4
  namespace: my-ns
spec:
  capacity:
    storage: 10Ti
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  nfs:
    path: /data/u4
    server: 10.30.136.79
    readOnly: false

PV在kubectl中看起来不错

The PV looks OK in kubectl

$ kubectl get pv
NAME            CAPACITY   ACCESSMODES   RECLAIMPOLICY   STATUS     CLAIM             STORAGECLASS   REASON    AGE
hq-storage-u4   10Ti       RWX           Retain          Released   my-ns/pv-50g                               49m

然后我尝试创建PersistentVolumeClaim:

I then try to create the PersistentVolumeClaim:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc-50gb
  namespace: my-ns
spec:
  accessModes:
  - ReadWriteMany
  resources:
     requests:
       storage: 5Gi

Kubectl显示pvc状态为Pending

Kubectl shows the pvc status is Pending

$ kubectl get pvc
NAME       STATUS    VOLUME    CAPACITY   ACCESSMODES   STORAGECLASS   AGE
pvc-50gb   Pending                                                     16m

当我尝试将卷添加到部署中时,出现错误:

When I try to add the volume to a deployment, I get the error:

[SchedulerPredicates failed due to PersistentVolumeClaim is not bound: "pvc-50gb", which is unexpected., SchedulerPredicates failed due to PersistentVolumeClaim is not bound: "pvc-50gb", which is unexpected., SchedulerPredicates failed due to PersistentVolumeClaim is not bound: "pvc-50gb", which is unexpected.]

如何使pvc进入工作状态?

How to I get the pvc to a working state?

推荐答案

原来,我需要将IP(我也放置路径)用引号引起来.修复此问题后,pvc进入绑定状态,并且吊舱可以正确安装.

It turned out that I needed to put the IP (I also put the path) in quotes. After fixing that, the pvc goes to status Bound, and the pod can mount correctly.

这篇关于Kubernetes NFS PersistentVolumeClaim的状态为Pending的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆