简体   繁体   中英

Extracting configmaps from services in kubernetes cluster using a spring microservice

We are trying to get live configuration data from our kubernetes cluster. Therefore we would like to read the configmaps from each of our services.

Is there a way to exctract this data with a spring microservice which runs alongside the rest of the services?

Or are there other (better?) ways / tools to get this information?

Using Kubernetes APIs you can get the configmaps you need. I am not familiar with the Java client, but here it is:

https://github.com/kubernetes-client/java

You can retrieve a list of configmaps and their contents using these APIs. Your application will need a cluster role and a cluster role binding to allow it reading from configmap resources if you're using RBAC.

To extract information you can just query the Kubernetes API, likely in your case using the Java Kubernetes client . Likely the biggest issue you will face will be ensuring you have read access for the namespace(s) that the ConfigMaps are in.

The bigger question about a 'better way' is trying to understand why you want to read all of the ConfigMaps for your applications. The goal you are trying to accomplish will guide the solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM