gpt4 book ai didi

kubernetes - Spring Cloud Kubernetes : What are cluster-reader permissions?

转载 作者:行者123 更新时间:2023-12-03 10:05:19 27 4
gpt4 key购买 nike

根据 Spring Cloud Kubernetes docs,以便在启用 RBAC 的 Kubernetes 发行版中发现服务/pod:

you need to make sure a pod that runs with spring-cloud-kubernetes has access to the Kubernetes API. For any service accounts you assign to a deployment/pod, you need to make sure it has the correct roles. For example, you can add cluster-reader permissions to your default service account depending on the project you’re in.



什么是 cluster-reader权限以发现服务/pods?

我收到的错误是:
io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: GET at: https://x.x.x.x/api/v1/namespaces/jx-staging/services. 
Message: Forbidden!Configured service account doesn't have access.
Service account may have been revoked. services is forbidden:
User "system:serviceaccount:jx-staging:default" cannot list services in the namespace "jx-staging"

最佳答案

阅读 endpointsservices似乎是 Spring Cloud Kubernetes 发现 pod 和服务的最低要求。

示例向 default 添加权限服务帐号在 default命名空间。

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: cluster-read-role
rules:
- apiGroups:
- ""
resources:
- endpoints
- pods
- services
- configmaps
verbs:
- get
- list
- watch

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: cluster-read-rolebinding
subjects:
- kind: ServiceAccount
name: default
namespace: default
roleRef:
kind: ClusterRole
name: cluster-read-role
apiGroup: rbac.authorization.k8s.io

关于kubernetes - Spring Cloud Kubernetes : What are cluster-reader permissions?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54654391/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com