<p>Problem:</p>
<p>I want every pod created in my cluster to hold\point the same data
e.g. let's say I want all of them to have an env vars like &quot;OWNER=MYNAME&quot;.
there are multiple users in my cluster and I don't want them to start changing their YAMLs and manually assign OWNER:MYNAME to env.</p>
<p>Is there a way to have all current/future pods to be assigned automatically with a predefined value or mount a configmap so that the same information will be available in every single pod?
can this be done on the cluster level? namespace level?
I want it to be transparent to the user, meaning a user would apply whatever pod to the cluster, and the info could be available to him without even asking.</p>
<p>Thanks, everyone!</p>

<p><a href="https://v1-19.docs.kubernetes.io/docs/concepts/workloads/pods/podpreset/" rel="nofollow noreferrer">Pod Preset</a> might help you here to partially achieve what you need. Pod Preset resource allows injecting additional runtime requirements into a Pod at creation time. You use label selectors to specify the Pods to which a given PodPreset applies.</p>
<p>Check this to know <a href="https://v1-19.docs.kubernetes.io/docs/concepts/workloads/pods/podpreset/#how-it-works" rel="nofollow noreferrer">how pod preset works</a>.</p>
<ul>
<li>First you need to <a href="https://v1-19.docs.kubernetes.io/docs/concepts/workloads/pods/podpreset/#enable-pod-preset" rel="nofollow noreferrer">enable pod preset in your cluster</a>.</li>
<li>You can use Pod Preset to <a href="https://v1-19.docs.kubernetes.io/docs/tasks/inject-data-application/podpreset/#use-pod-presets-to-inject-environment-variables-and-volumes" rel="nofollow noreferrer">inject env variables or volumes</a> in your pod.</li>
<li>You can also <a href="https://v1-19.docs.kubernetes.io/docs/tasks/inject-data-application/podpreset/#pod-spec-with-configmap-example" rel="nofollow noreferrer">inject configmap</a> in your pod.</li>
<li>Make use of some common label for all the pods which you want to have common config, use this common label in your pod preset resource.</li>
</ul>
<p>Unfortunately there are <a href="https://github.com/kubernetes/kubernetes/issues/93900" rel="nofollow noreferrer">plans to remove pod presets altogether</a> in coming releases, but I guess you can still use it with current releases. Although there are <a href="https://github.com/redhat-cop/podpreset-webhook" rel="nofollow noreferrer">other implementations similar to pod presets</a>, which you can try.</p>
