Search code examples
google-cloud-platformgoogle-cloud-run

Google Cloud Run only has access to subset of metadata on http://metadata.google.internal


Problem: Google Cloud Run only provides a subset of documented metadata

I have a simple JVM based application running on Google Cloud Run that queries http://metadata.google.internal for available metadata.

The only metadata available is at the following paths:

  • http://metadata.google.internal/computeMetadata/v1/instance/service-accounts
  • http://metadata.google.internal/computeMetadata/v1/instance/zone
  • http://metadata.google.internal/computeMetadata/v1/project/project-id
  • http://metadata.google.internal/computeMetadata/v1/project/numeric-project-id

As per the documentation, I was expecting more than this and hoping that I would be able to query the metadata server for the name of the Cloud Run service and the metadata required to configure Stackdriver Monitoring for a generic_node.

One clue that I have found is in the server header in the response from querying the Metadata server gives the value: Metadata Server for Serverless

Theory: Cloud Run is in beta and the Metadata Server for Serverless is separate from the typical metadata server and is a work in progress.

Question(s):

  1. Is this theory valid?
  2. Is this limitation documented somewhere?
    • Is there a roadmap for adding additional metadata?
  3. Is there an alternative for determining the metadata needed to configure Stackdriver?

Solution

  • It's documented under Instance metadata server | Container runtime contract by now.