User "system:serviceaccount:bcs-dev:default" cannot get resource "services" in API group "" in the namespace "network"

apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: gitlab-admin-binding namespace: gitlab roleRef: apiGroup: rbac.authorization.k8s.io kind: Role name: gitlab-admin subjects:

  • kind: ServiceAccount name: gitlab

apiVersion: v1 kind: ServiceAccount metadata: name: gitlab namespace: gitlab EOF

全局授权 admin 权限

cat « EOF | kubectl apply -f -

kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 metadata: name: gitlab-admin rules:

  • verbs:
    • ‘*’ apiGroups:
    • ‘*’ resources:
    • ‘*’
  • verbs:
    • ‘*’ nonResourceURLs:
    • ‘*’

apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: gitlab-admin-binding roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: gitlab-admin subjects:

  • kind: ServiceAccount name: gitlab namespace: gitlab

apiVersion: v1 kind: ServiceAccount metadata: name: gitlab namespace: gitlab EOF

1
2

刚好也使用springboot-cloud-kubernertes来处理
Licensed under CC BY-NC-SA 4.0
最后更新于 Jan 06, 2025 05:52 UTC
comments powered by Disqus
Built with Hugo
主题 StackJimmy 设计
Caret Up