Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can I share some value between kubernetes pods?

I have several pods which belong to the same service. I need to share a value between all pods in this service.

Per my understanding, the shared volume won’t work well, because pods may end up being on different nodes.

Having any kind of database (even most lightweight) exposed as a service to share this value would be overkill (however, probably it’s my backup plan).

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I was wondering whether there is some k8s native way to share the value.

>Solution :

Put the values in a ConfigMap and mount it in the Pods. You can include the values of the ConfigMap in the containers of a Pod either as a volume or as environment variables.

See Configure a Pod to Use a ConfigMap in the Kubernetes documentation.

If the Pods need to update the shared values they can write to the ConfigMap (requires Kubernetes API permissions). However, in this case the ConfigMap must be included as a volume, since environment variable values from a ConfigMap are not updated when the ConfigMap changes.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading