不支持的值:“ rbac.authorization.k8s.io”

时间:2018-10-29 17:14:00

标签: kubernetes

当我尝试

kubectl create -f cloudflare-argo-rolebinding.yml

此RoleBinding

kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: cloudflare-argo-rolebinding
  namespace: default
subjects:
- kind: ServiceAccount
  name: cloudflare-argo
  apiGroup: rbac.authorization.k8s.io
roleRef:
  kind: Role
  name: cloudflare-argo-role
  apiGroup: rbac.authorization.k8s.io

我收到此错误:

The RoleBinding "cloudflare-argo-rolebinding" is invalid: subjects[0].apiGroup: Unsupported value: "rbac.authorization.k8s.io": supported values: ""

有什么主意吗?如果有帮助,我正在使用DigitalOcean的新Kubernetes服务。

2 个答案:

答案 0 :(得分:2)

我认为问题是使用了错误的apiGroup

kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: cloudflare-argo-rolebinding
  namespace: default
subjects:
- kind: ServiceAccount
  name: cloudflare-argo
  # apiGroup is ""(core/v1) for service_account
  apiGroup: ""
roleRef:
  kind: Role
  name: cloudflare-argo-role
  apiGroup: rbac.authorization.k8s.io

答案 1 :(得分:1)

ServiceAccount主题位于v1 API中,即apiGroup“”