- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 Kubernetes 中有一个部署。在此部署中,我可以指定持久卷声明,如下所示:
volumes:
- name: my-volume
persistentVolumeClaim:
claimName: my-claim
我有一个磁盘(准确地说是 Azure 磁盘),其中包含大量预处理数据,我可以在 Kubernetes 中将其公开为名为 my-claim
的 PVC。在下一步中,我将其链接到部署,如上所示。这种方法的问题是,我无法将部署扩展到多个 pod。
如何扩展此设置?我尝试复制该磁盘并将其创建为具有不同名称的第二个 PVC。这有效,但现在我没有找到一种方法来告诉 Kubernetes 部署,每个 pod 应该挂载这两个 PVC 之一。
我希望有一个选项可以使用通用标签来标记两个 PVC,然后将我的部署链接到该标签而不是 PVC 名称。是否存在类似的情况,或者我的方法完全错误?
谢谢!
最佳答案
I have a disk (an Azure disk to be precise) with lots of preprocessed data, which I can expose in Kubernetes as PVC with name my-claim. In the next step I link it to the deployment as shown above. The problem with this approach is, that I cannot scale the deployment to more than one pod.
在这里,您使用带有 Access Mode 的 PersistentVolumeClaim
ReadWriteOnce
(这是 Azure 磁盘的唯一选项,请参阅访问模式链接)
How can I scale this setup? I tried to duplicate the disk and create it as second PVC with a different name. This worked, but now I don't see a way to tell the Kubernetes deployment, that each pod should mount one of these two PVCs.
在这里,听起来您想要一个具有访问模式的卷ReadOnlyMany
- 因此您需要考虑支持此访问模式的存储系统>.
I tried to duplicate the disk and create it as second PVC with a different name. This worked, but now I don't see a way to tell the Kubernetes deployment, that each pod should mount one of these two PVCs.
这不适用于 Deployment因为每个 pod 的模板
都是相同的。但你可以用 StatefulSet 来做到这一点,使用 volumeClaimTemplates
声明您的 PVC - 然后每个 Pod 的 PVC 都具有唯一的、众所周知的身份。
StatefulSet 的示例部分:
volumeClaimTemplates:
- metadata:
name: my-pvc
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: "my-storage-class"
resources:
requests:
storage: 1Gi
然后,如果您有 StatefulSet 的两个副本,它们将为您提供一个名为 my-pvc-0
和 my-pvc-1
的 PVC,其中编号称为“序数”。 volumeClaimTemplate
仅在新的 PVC 不存在时创建它,因此,如果您创建了具有正确名称的 PVC - 将使用现有的 PVC。
Azure 磁盘的替代存储解决方案是 Azure 文件。 Azure 文件支持访问模式ReadWriteOnce
、ReadOnlyMany
和ReadWriteMany
。请参阅Dynamically create and use a persistent volume with Azure Files in Azure Kubernetes Service (AKS) .
可能还有其他更适合您的应用程序的存储替代方案。
关于azure - 我可以通过标签或选择器而不是名称将 K8s 部署链接到 PVC 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64936298/
我正在尝试创建可以稍后根据需要调整大小的 pvc。 我正在使用来自 github 的代码 mongodb pvc . 我按照所有步骤创建了 pvc,如下所示: PS C:\Users> minikub
我正在尝试创建可以稍后根据需要调整大小的 pvc。 我正在使用来自 github 的代码 mongodb pvc . 我按照所有步骤创建了 pvc,如下所示: PS C:\Users> minikub
我已经为 mysql 部署了带有状态 pod 的 kubernetes 集群。对于每个 pod,我有不同的 PVC。 例如:如果 3 个 pod thn 3 个 5GB EBS PVC SO 对所有
我想在AWS上设置PVC,在这里我需要ReadWriteMany作为访问模式。不幸的是,EBS仅支持ReadWriteOnce。 我该如何解决? 我已经看到有一个AWS EFS的beta提供程序,它支
我正在尝试使用 https://github.com/kubernetes/kubernetes/tree/release-1.7/examples/persistent-volume-provisi
我在 GKE 上有一个简单的 kubernetes 集群设置。为了持久化我的 express web 应用程序的数据,我有一个 mongodb 部署、用于 mongodb 部署的 cluster-ip
当我尝试编辑 PVC 时,Kubernetes 给出错误提示: The StatefulSet "es-data" is invalid: spec: Forbidden: updates to st
我一直在努力运行简单的3节点Kubernetes集群。 $ kubectl get nodes
是否可以从命名空间-B 引用 PVC(在命名空间-A 中)。为什么我需要那个?我想让客户(私有(private)云)通过 PVC 指向他们的卷,让他们完全控制存储。在 Helm 安装时会询问 PVC
我通过调用创建了以下持久卷 kubectl create -f nameOfTheFileContainingTheFollowingContent.yaml apiVersion: v1 kind:
我们的方案: 我们使用ceph rbd存储一些机器学习训练数据集,其工作流程如下: 使用AccessMode:ReadWriteOnce创建一个ceph-rbd pvc pvc-tranining-d
我的应用程序在 google kubernetes 引擎上运行,目前使用 pvc 进行数据存储。我只是无法决定我们应该使用 PVC 还是磁盘的存储选项? 在 PVC 的情况下,我们不能有快照,除此之外
从今天早上开始,我心里有个问题。 在 Kubernetes 上管理文件配置的最佳方法是什么! 目前我们使用PVC & PV 但我想更新 自动在期间CI管道配置文件。对于一个应用程序,我们几乎有 10
我有一个 3 节点 coros kubernetes 集群启动并运行。 我想使用来自独立 NFS 服务器的 persitentvolumes(pv)。 nfs.yaml apiVersion: v1
pvc扩容分析。pvc存储扩容分析。存储的扩容分为controller端操作与node端操作两大步骤,controller端操作由external-resizer来调用ceph完成,而node端操作由
我正在练习使用 Minikube 制作 PV 和 PVC。但是遇到了我的InfluxDB部署找不到influxdb-pvc的错误,无法解决。 我查看事件顶部的消息,发现找不到我的 PVC。因此,我检查
我的 pod 声明了两个不同的卷。 我使用了一些定义模板,并且在某些情况下取决于环境,我想对两卷使用相同的声明。 这导致错误 Unable to mount volumes for pod "
我们设置了一个包含多个可用区节点池的 AKS 集群。使用 default 存储类,如果 Pod 需要移动到另一个节点,并且唯一可用的节点位于不同的区域,则 Pod 无法启动,因为存储卡在原始区域。其他
我部署了一个 PVC,它动态创建了一个 PV。之后我删除了 PVC,现在我的 PV 如下所示: PS Kubernetes> kubectl get pv NAME
我正在尝试为我的拉取请求设置预览环境。每个环境都需要自己的预填充数据库。 我的种子数据库大约有 15GB。 我有一个引导 MySQL 镜像并将 /var/lib/mysql 内容复制到 PVC 卷的过
我是一名优秀的程序员,十分优秀!