<p>I'm trying to generate a <strong>Unique Key</strong> in the application, using date/time and a number sequence managed by the application. It works fine as we don't have multiapplication.</p>
<p>The application is running in a Kubernetes pod with auto scaling configured.</p>
<p>Is there any way to generate or get a <strong>unique and numeric identifier per pod</strong> and put them in the container environment variables? there is no need for the intentifier to be fixed to use the statefulSets</p>
<p><strong>UPDATE</strong></p>
<p>the problem we are having with the uid is the size of the collections, tha's why we're are looking for a solution that's about the size of a bigInt, and if there is any other numberic unique id similar as an alternative of use for the UID.</p>

lego
<p><code>...get a unique and numeric identifier per pod and put them in the container environment variables?</code></p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: busybox
  labels:
    run: busybox
spec:
  restartPolicy: Never
  containers:
  - name: busybox
    image: busybox
    command: [&quot;ash&quot;,&quot;-c&quot;,&quot;echo ${MY_UID} &amp;&amp; sleep 3600&quot;]
    env:
    - name: MY_UID
      valueFrom:
        fieldRef:
          fieldPath: metadata.uid
</code></pre>
<p>Run <code>kubectl logs &lt;pod&gt;</code> will print you the unique ID assigned to the environment variable in your pod.</p>
