<p>I'm looking for a way to uniquely identify a cluster:</p>
<ul>
<li>Something that can't be moved to another cluster such as a secret</li>
<li>Something that can be accessed by the application (e.g. an environment variable or stored in an object that can populate env vars</li>
<li>Something that is unlikely to change over time for a given cluster.</li>
</ul>
<p>What would that something be?</p>

<p>With OpenShift 4.x, you can find the unique Cluster ID for each cluster in the <code>clusterversion</code> CRD:</p>
<pre><code>$ oc get clusterversion -o jsonpath='{.items[].spec.clusterID}{&quot;\n&quot;}'
</code></pre>
<p>The <code>clusterversion</code> object looks like this:</p>
<pre><code>$ oc get clusterversion version -o yaml

apiVersion: config.openshift.io/v1
kind: ClusterVersion
metadata:
  name: version
  [..]
spec:
  channel: stable-4.4
  clusterID: 990f7ab8-109b-4c95-8480-2bd1deec55ff
[..]
</code></pre>
<p>Source: <a href="https://docs.openshift.com/container-platform/4.2/support/gathering-cluster-data.html#support-get-cluster-id_gathering-cluster-data" rel="nofollow noreferrer">https://docs.openshift.com/container-platform/4.2/support/gathering-cluster-data.html#support-get-cluster-id_gathering-cluster-data</a></p>
