<p>I'm going to run several Kubernetes Clusters in different public clouds and even on-prem ones (which will be in different locations). I'm gonna have the same HTML/javascript website running on all of them. I'd like to be able to change an image based on what cluster I am in. The image itself will display what cluster it's currently in eg: AWS, Azure, GCP, etc.</p>
<p>For instance, every time you refresh you end up in a different cluster and you can see which one because the image will be displayed.</p>
<p>I don't have a clue how to do this. So far I'm sure it'll require JavaScript.</p>

J_W
<p>Each cloud vendor usually has a metadata server. Google, AWS and Azure have metadata services that you can read configuration details from using HTTP.</p>
<p>To determine the cloud vendor on Linux read the Cloud Init Instance data. The JSON key <code>cloud-name</code> will tell you the cloud vendor.</p>
<p>Read this file and parse the JSON data:</p>
<pre><code>/run/cloud-init/instance-data.json
</code></pre>
<p>Consult the documentation for each service, see the links below. Once you know which cloud you are running on, you can query for the region, cluster name, etc. Your server-side code can then display anything you want to clients.</p>
<p>AWS Endpoint:</p>
<pre><code>http://169.254.169.254/latest/meta-data/
</code></pre>
<p><a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html" rel="nofollow noreferrer">AWS Documentation</a></p>
<p>Azure Endpoint:</p>
<pre><code>http://169.254.169.254/metadata/instance?api-version=2020-06-01
</code></pre>
<p><a href="https://azure.microsoft.com/en-us/resources/videos/azure-friday-azure-instance-metadata-service-jayaraman/" rel="nofollow noreferrer">Azure Documentation</a></p>
<p>Google Endpoint:</p>
<pre><code>http://metadata.google.internal/computeMetadata
</code></pre>
<p><a href="https://cloud.google.com/compute/docs/storing-retrieving-metadata" rel="nofollow noreferrer">Google Documentation</a></p>
