<p>I have several pods which belong to the same service. I need to share a value between all pods in this service.</p>
<p>Per my understanding, the shared volume won't work well, because pods may end up being on different nodes.</p>
<p>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).</p>
<p>I was wondering whether there is some k8s native way to share the value.</p>

Victor Ronin
<p>Put the values in a <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#configmap-v1-core" rel="noreferrer">ConfigMap</a> and mount it in the Pods. You can include the values of the ConfigMap in the containers of a Pod either as a <a href="https://kubernetes.io/docs/concepts/storage/volumes/#configmap" rel="noreferrer">volume</a> or as <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#configure-all-key-value-pairs-in-a-configmap-as-container-environment-variables" rel="noreferrer">environment variables</a>.</p>
<p>See <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/" rel="noreferrer">Configure a Pod to Use a ConfigMap</a> in the Kubernetes documentation.</p>
<p>If the Pods need to update the shared values they can write to the ConfigMap (requires <a href="https://kubernetes.io/docs/reference/access-authn-authz/rbac/" rel="noreferrer">Kubernetes API permissions</a>). 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.</p>
