RoleBinding 和 ClusterRoleBinding 中的 Kubernetes RBAC apiGroup 字段
Kubernetes RBAC apiGroup field in RoleBinding and ClusterRoleBinding
为什么我们要在这个定义中一遍又一遍地写apiGroup键,如果每次都一样的话:
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: web-rw-deployment
namespace: some-web-app-ns
subjects:
- kind: User
name: "joesmith@example.com"
apiGroup: rbac.authorization.k8s.io
- kind: Group
name: "webdevs"
apiGroup: rbac.authorization.k8s.io
roleRef:
kind: Role
name: web-rw-deployment
apiGroup: rbac.authorization.k8s.io
- 这看起来太冗长了,所有内容都在重复
- 如果我们需要写它,其他值是什么
- 如果 RBAC apiGroup 字段没有其他值,那么 k8s 应该自动假定该值
apiGroup: rbac.authorization.k8s.io
这使得 yaml 过于多余,有什么办法可以解决这个问题。我们可以跳过这个键吗?或者我们可以在全球某个地方声明它吗?
为什么我们要在这个定义中一遍又一遍地写apiGroup键,如果每次都一样的话:
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: web-rw-deployment
namespace: some-web-app-ns
subjects:
- kind: User
name: "joesmith@example.com"
apiGroup: rbac.authorization.k8s.io
- kind: Group
name: "webdevs"
apiGroup: rbac.authorization.k8s.io
roleRef:
kind: Role
name: web-rw-deployment
apiGroup: rbac.authorization.k8s.io
- 这看起来太冗长了,所有内容都在重复
- 如果我们需要写它,其他值是什么
- 如果 RBAC apiGroup 字段没有其他值,那么 k8s 应该自动假定该值
apiGroup: rbac.authorization.k8s.io
这使得 yaml 过于多余,有什么办法可以解决这个问题。我们可以跳过这个键吗?或者我们可以在全球某个地方声明它吗?