KubernetesClientException:ClusterRole或Role

问题描述 投票:0回答:1

在使用Spring Cloud Kubernetes Discovery Client部署服务时,我收到KubernetesClientException,指出禁止用户“default”访问pod。

我已经添加了一个角色和一个Rolebinding指定here

该指南指出ClusterRole是必要的。但这不是我的选择,因为我们与其他部门共享集群。我只希望角色影响我们的项目/命名空间。

ClusterRole是否需要或角色是否足够?

kubernetes rbac openshift-enterprise spring-cloud-kubernetes
1个回答
0
投票

要允许服务帐户访问这些帐户需要创建具有必要权限的角色并将其分配给帐户。这可以通过群集角色或角色(如果只需要在一个名称空间中)和角色绑定来完成,特定于命名空间。

它表示您可以使用Role或ClusterRole。

在创建角色时请记住,应该定义命名空间。即

kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  namespace: mynamespace
  name: service-discovery-client
rules:
- apiGroups: [""] # "" indicates the core API group
  resources: ["services", "pods", "configmaps", "endpoints"]
  verbs: ["get", "watch", "list"]
最新问题
© www.soinside.com 2019 - 2024. All rights reserved.