Kubernetes持久卷在未决状态下无限期主张

编程入门 行业动态 更新时间:2024-10-27 16:39:56
本文介绍了Kubernetes持久卷在未决状态下无限期主张的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我创建了一个PersistentVolume,它源于我已经格式化并提供数据的Google Compute Engine永久磁盘.Kubernetes说PersistentVolume可用.

I created a PersistentVolume sourced from a Google Compute Engine persistent disk that I already formatted and provision with data. Kubernetes says the PersistentVolume is available.

kind: PersistentVolume apiVersion: v1 metadata: name: models-1-0-0 labels: name: models-1-0-0 spec: capacity: storage: 200Gi accessModes: - ReadOnlyMany gcePersistentDisk: pdName: models-1-0-0 fsType: ext4 readOnly: true

然后我创建了一个PersistentVolumeClaim,以便可以将此卷附加到多个节点上的多个Pod.但是,kubernetes无限期地表示它处于挂起状态.

I then created a PersistentVolumeClaim so that I could attach this volume to multiple pods across multiple nodes. However, kubernetes indefinitely says it is in a pending state.

kind: PersistentVolumeClaim apiVersion: v1 metadata: name: models-1-0-0-claim spec: accessModes: - ReadOnlyMany resources: requests: storage: 200Gi selector: matchLabels: name: models-1-0-0

有什么见解?我觉得选择器可能有问题...

Any insights? I feel there may be something wrong with the selector...

是否甚至可以用数据预配置永久性磁盘,并使跨多个节点的Pod都可以从中读取数据?

Is it even possible to preconfigure a persistent disk with data and have pods across multiple nodes all be able to read from it?

推荐答案

我很快意识到,如果未指定,PersistentVolumeClaim将 storageClassName 字段默认为 standard .但是,在创建PersistentVolume时, storageClassName 没有默认值,因此选择器找不到匹配项.

I quickly realized that PersistentVolumeClaim defaults the storageClassName field to standard when not specified. However, when creating a PersistentVolume, storageClassName does not have a default, so the selector doesn't find a match.

以下内容对我有用:

kind: PersistentVolume apiVersion: v1 metadata: name: models-1-0-0 labels: name: models-1-0-0 spec: capacity: storage: 200Gi storageClassName: standard accessModes: - ReadOnlyMany gcePersistentDisk: pdName: models-1-0-0 fsType: ext4 readOnly: true --- kind: PersistentVolumeClaim apiVersion: v1 metadata: name: models-1-0-0-claim spec: accessModes: - ReadOnlyMany resources: requests: storage: 200Gi selector: matchLabels: name: models-1-0-0

更多推荐

Kubernetes持久卷在未决状态下无限期主张

本文发布于:2023-11-24 04:06:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1623907.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:持久   状态下   Kubernetes

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!