az *_*rnd 1 kubernetes kubectl kubernetes-pod
我正在尝试从我的另一个 pod 访问所有命名空间和 pod。因此,我创建了 clusterrole、clusterrolebinding 和 service account。我能够访问唯一的客户命名空间资源。但我需要访问所有命名空间资源。是否可以?
apiVersion: v1
kind: ServiceAccount
metadata:
name: spinupcontainers
namespace: customer
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: spinupcontainers
namespace: customer
rules:
- apiGroups: [""]
resources: ["pods", "pods/exec"]
verbs: ["get", "list", "delete", "patch", "create"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: spinupcontainers
namespace: customer
subjects:
- kind: ServiceAccount
name: spinupcontainers
roleRef:
kind: ClusterRole
name: spinupcontainers
apiGroup: rbac.authorization.k8s.io
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮助解决这个问题吗?
提前致谢
在您的 YAML 示例中,您似乎使用的是 aRoleBinding而不是ClusterRoleBinding. ARoleBinding仅在命名空间内授予这些权限。另请参阅有关此主题的Kubernetes 文档:
RoleBinding 授予特定命名空间内的权限,而 ClusterRoleBinding 授予该访问集群范围的权限。
| 归档时间: |
|
| 查看次数: |
849 次 |
| 最近记录: |