作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的自定义命名空间中有以下定义:
apiVersion: v1
kind: ServiceAccount
metadata:
name: test-sa
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: test
rules:
- apiGroups: [""]
resources: ["pods", "pods/exec"]
verbs: ["get", "list", "delete", "patch", "create"]
- apiGroups: ["extensions", "apps"]
resources: ["deployments", "deployments/scale"]
verbs: ["get", "list", "delete", "patch", "create"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: test
subjects:
- kind: User
name: test-sa
apiGroup: rbac.authorization.k8s.io
roleRef:
kind: Role
name: test
apiGroup: rbac.authorization.k8s.io
describe role test
Name: test
Labels: <none>
Annotations: kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"rbac.authorization.k8s.io/v1","kind":"Role","metadata":{"annotations":{},"name":"test","namespace":"test-namesapce...
PolicyRule:
Resources Non-Resource URLs Resource Names Verbs
--------- ----------------- -------------- -----
pods/exec [] [] [get list delete patch create]
pods [] [] [get list delete patch create]
deployments.apps/scale [] [] [get list delete patch create]
deployments.apps [] [] [get list delete patch create]
deployments.extensions/scale [] [] [get list delete patch create]
deployments.extensions [] [] [get list delete patch create]
kubectl get pods
在使用此服务帐户的 pod 中,我收到以下错误:
Error from server (Forbidden): pods is forbidden: User "system:serviceaccount:test-namespace:test-sa" cannot list resource "pods" in API group "" in the namespace "test-namespace"
最佳答案
问题出在 subjects
的 RoleBinding
.正确的定义是:
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: test
subjects:
- kind: ServiceAccount
name: test-sa
roleRef:
kind: Role
name: test
apiGroup: rbac.authorization.k8s.io
关于kubernetes - ServiceAccount 无法在命名空间中列出资源 "pods",尽管它具有具有适当资源的角色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59375922/
这段代码在 Java 中的等价物是什么?我放了一部分,我对 I/O 部分感兴趣: int fd = open(FILE_NAME, O_WRONLY); int ret = 0; if (fd =
我正在尝试将维度为 d1,d2,d3 的张量 M[a1,a2,a3] reshape 为维度为 d2, d1*d3 的矩阵 M[a2,a1*a3]。我试过 M.reshape(d2,d1*d3) 但是
我是一名优秀的程序员,十分优秀!