Согласно документам Весеннее облако Kubernetes, для обнаружения сервисов/модулей в дистрибутивах Kubernetes с поддержкой RBAC:
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-readerpermissions to your default service account depending on the project you’re in.
Что такое cluster-reader разрешения для обнаружения сервисов/модулей?
Ошибка, которую я получаю:
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"

Kubernetes обычно разделяет роли на два типа:
Итак, что означает документация Spring Cloud Kubernetes, так это то, что для того, чтобы иметь возможность правильно читать обнаружение сервисов/модулей во всех пространствах имен, ServiceAccount, который будет связан с приложением, должен иметь ClusterRole, который позволяет ему читать Pods, Services и т. д.
Часть Этот документации Kubernetes (которая также содержит отличные примеры) обязательна к прочтению для общего понимания RBAC Kubernetes.
Чтение endpoints и services кажется минимальным для Spring Cloud Kubernetes для обнаружения модулей и сервисов.
В примере добавляются разрешения для служебной учетной записи 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