节点找不到可用的持久卷来绑定 [英] Node didn't find available persistent volumes to bind

查看:1476
本文介绍了节点找不到可用的持久卷来绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到

1个节点找不到可用的持久卷来绑定.

1 node(s) didn't find available persistent volumes to bind.

创建我的Pod以附加到永久存储后.

upon creating my pod to attach to Persistent Storage.

我在下面进行了设置.

I have setup below.

PersistentVolumeStorageClass创建并成功附加. 一旦我创建了PersistentVolumeClaim,它就会以待处理"状态等待,这是预期的(我相信),因为 由于StorageClass的"WaitForFirstConsumer"设置,它会等待pod连接.

PersistentVolume and StorageClass created and attached successfully. Once I create PersistentVolumeClaim, it waits in "pending" state, which is expected (I believe) because it waits a pod to connect due to "WaitForFirstConsumer" setting of StorageClass.

apiVersion: v1
kind: PersistentVolume
metadata:
  name: example-local-pv
spec:
  capacity:
    storage: 2Gi
  accessModes:
  - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  storageClassName: local-storage
  local:
    path: /home/aozdemir/k8s
  nodeAffinity:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: kubernetes.io/hostname
          operator: In
          values:
          - my-node
---
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: local-storage
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: example-local-claim
spec:
  accessModes:
  - ReadWriteOnce
  storageClassName: local-storage
  resources:
    requests:
      storage: 2Gi
---
kind: Pod
apiVersion: v1
metadata:
  name: task-pv-pod
spec:
  volumes:
    - name: task-pv-storage
      persistentVolumeClaim:
       claimName: example-local-claim
  containers:
    - name: task-pv-container
      image: nginx
      ports:
        - containerPort: 80
          name: "http-server"
      volumeMounts:
        - mountPath: "/usr/share/nginx/html"
          name: task-pv-storage

我的问题是,在创建Pod之后,它会发出以下警告:

My problem is that, after I create the Pod, it gives following warning:

0/1个节点可用:1个节点未找到可用的持久性节点 要绑定的卷.

0/1 nodes are available: 1 node(s) didn't find available persistent volumes to bind.

这是屏幕截图:

我在这里想念东西吗?

推荐答案

这很糟糕. 由于以下博客文章: https://kubernetes.io /blog/2018/04/13/local-persistent-volumes-beta/

It was my bad. Due to following blog post: https://kubernetes.io/blog/2018/04/13/local-persistent-volumes-beta/

请注意,PersistentVolume中有一个新的 nodeAffinity 字段 对象:Kubernetes调度程序就是这样理解的 PersistentVolume绑定到特定节点. nodeAffinity是一个 必填字段,用于本地PersistentVolumes .

Note that there’s a new nodeAffinity field in the PersistentVolume object: this is how the Kubernetes scheduler understands that this PersistentVolume is tied to a specific node. nodeAffinity is a required field for local PersistentVolumes.

,我的值不正确.我将其更改为我的节点名称,然后重新部署,它可以正常工作.

and my value was incorrect. I changed it to my node name, and re-deployed, it worked.

这篇关于节点找不到可用的持久卷来绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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