I have a Spring Cloud configuration service running on OpenShift that uses a Git repository as its backend storage. Every time I make changes to configuration properties in the Git repo, I encounter a permission error.
The error shows that the service account lacks proper Kubernetes permissions:
2019-12-25 08:15:22.445 WARN 1 --- [nio-8080-exec-2] o.s.cloud.kubernetes.StandardPodUtils : Cannot retrieve pod information for:[app-config-45-xyz89]. Check if required serviceaccount permissions are configured properly.
io.fabric8.kubernetes.client.KubernetesClientException: Request failed: GET at: https://kubernetes.default.svc/api/v1/namespaces/dev-env/pods/app-config-45-xyz89. Message: Access Denied! Service account permissions insufficient. pods "config-service-45-xyz89" is forbidden: User "system:serviceaccount:dev-env:default" cannot access resource "pods" in API group "" in the namespace "dev-env".
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.requestFailure(OperationSupport.java:485) ~[kubernetes-client-3.1.10.jar!/:na]
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.assertResponseCode(OperationSupport.java:421) ~[kubernetes-client-3.1.10.jar!/:na]
How can I fix these service account permissions so my config server can properly fetch updates from the Git backend?