Spring Cloud Kubernetes: Timeout waiting for informers cache to be ready Spring Cloud Kubernetes: Timeout waiting for informers cache to be ready kubernetes kubernetes

Spring Cloud Kubernetes: Timeout waiting for informers cache to be ready


I managed to get rid of the error messages by using the Fabric8 client instead of the official client. This simple change was enough to get rid of my problems.

This was done by changing the dependency in pom.xml from spring-cloud-starter-kubernetes-client-all to spring-cloud-starter-kubernetes-fabric8-all.

As this doesn't seem like expected behavior, I opened a bug report on the Spring Cloud Kubernetes project on GitHub.


You haven't posted your yaml configuration and how you applied it, so I cannot give guidance what's exactly wrong in your case. However, a possible cause for your issue could be a wrong token for the service account.

Reading the Security Configurations Inside Kubernetes part of the docs, we see the following quote:

For Kubernetes (1.3+), the namespace is made available to the pod aspart of the service account secret and is automatically detected bythe client

This means that if the service account's secret that the pod uses has for any reason misconfigured namespace, the kubernetes client will silently ignore the error and continue to try to list services/endpoints in a wrong namespace to which access is actually not granted.

You can list secrets in the namespace joaomlneto with:

kubectl get secrets --namespace joaomlneto

You can then check the namespace of the default service account token for the same namespace with:

kubectl get secret/default-token-..... --template='{{.data.namespace}}' --namespace joaomlneto

The base64-encoded output should decode to joaomlneto. If not, you will have issues with permissions. To fix it, you can delete and then recreate the service account, properly configuring it this time.


You need to grant neccessary permissions to your spring app, with dependency spring-cloud-starter-kubernetes-fabric8-all that you're using, you will need to grant these permissions: "configmaps", "pods", "services", "endpoints", "secrets".

Below is an example from Spring Cloud document :

kind: RoleapiVersion: rbac.authorization.k8s.io/v1metadata:  namespace: YOUR-NAME-SPACE  name: namespace-readerrules:  - apiGroups: ["", "extensions", "apps"]    resources: ["configmaps", "pods", "services", "endpoints", "secrets"]    verbs: ["get", "list", "watch"]---kind: RoleBindingapiVersion: rbac.authorization.k8s.io/v1metadata:  name: namespace-reader-binding  namespace: YOUR-NAME-SPACEsubjects:- kind: ServiceAccount  name: default  apiGroup: ""roleRef:  kind: Role  name: namespace-reader  apiGroup: ""

Link : https://docs.spring.io/spring-cloud-kubernetes/docs/current/reference/html/index.html