2

我有一个在正确的命名空间中运行的持久卷:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: raw-data
spec:
  accessModes:
    - ReadWriteOnce
  capacity:
    storage: 2Gi
  hostPath: 
    path: /data
  storageClassName: storage

并希望运行包含批量声明模板的工作流:

...
  volumeClaimTemplates:
  - metadata:
      name: raw-data
    spec:
      accessModes: ["ReadWriteOnce"]
      resources:
        requests:
          storage: 2Gi

我相信我的配置与此处描述的一致 https://stackoverflow.com/a/52669115/213269但是,由于我正在研究 argo 而不是 kubernetes,因此存在一些差异。我收到以下错误:

 Unschedulable: 0/1 nodes are available: 1 pod has unbound immediate PersistentVolumeClaims.

问题:如何正确配置卷?

更新:

我尝试将持久卷部署到 argo 命名空间并从工作流中指向它,现在出现以下错误:

persistentvolumeclaims "workflow-name" is forbidden: User "system:serviceaccount:argo:argo" cannot get resource "persistentvolumeclaims" in API group "" in the namespace "argo"

我还在 Kubernetes 配置中添加了一个新用户和上下文,但无济于事。

更新:

我添加了以下角色,现在错误已从“...用户无法获取资源...”更改为“用户无法创建资源...”请注意,我的用户确实有权创建持久性卷声明。

apiVersion: rbac.authorization.k8s.io/v1                                                                                                                                                                         kind: Role                                                                                                                                                                                                       metadata:                                                                                                                                                                                                          name: workflow                                                                                                                                                                                                   namespace: argo                                                                                                                                                                                                rules:                                                                                                                                                                                                           - apiGroups:                                                                                                                                                                                                       - ""                                                                                                                                                                                                             resources:                                                                                                                                                                                                       - pods                                                                                                                                                                                                           verbs:                                                                                                                                                                                                           - get                                                                                                                                                                                                            - list                                                                                                                                                                                                           - watch                                                                                                                                                                                                          - create                                                                                                                                                                                                         - update                                                                                                                                                                                                         - patch                                                                                                                                                                                                          - delete                                                                                                                                                                                                       - apiGroups:                                                                                                                                                                                                       - ""                                                                                                                                                                                                             resources:                                                                                                                                                                                                       - pods/log                                                                                                                                                                                                       verbs:                                                                                                                                                                                                           - get                                                                                                                                                                                                            - list                                                                                                                                                                                                           - watch                                                                                                                                                                                                          - create                                                                                                                                                                                                         - update                                                                                                                                                                                                         - patch                                                                                                                                                                                                          - delete                                                                                                                                                                                                       - apiGroups:                                                                                                                                                                                                       - ""                                                                                                                                                                                                             resources:                                                                                                                                                                                                        - persistentvolumeclaims                                                                                                                                                                                        verbs:                                                                                                                                                                                                           - get                                                                                                                                                                                                            - list                                                                                                                                                                                                           - watch                                                                                                                                                                                                          - create                                                                                                                                                                                                         - update                                                                                                                                                                                                         - patch                                                                                                                                                                                                          - delete 
4

1 回答 1

1

这似乎是一个 RBAC 问题。确保您用来提交工作流的服务帐户对卷具有读取权限。

于 2020-11-20T19:50:41.907 回答