Detect Google Cloud Project Id from a container in Google hosted Kubernetes cluster.
When connecting to BigTable; I need to provide the Google Project Id. Is there a way to detect this automatically from within K8s?
To view your clusters, go to the Google Kubernetes Engine page in the Google Cloud console. To see more information about a cluster, select the cluster from the list.
To find out the Kubernetes cluster ID or NAME , get a list of Kubernetes clusters from the folder or detailed information about the Kubernetes cluster.
kubectl get − This command is capable of fetching data on the cluster about the Kubernetes resources. kubectl logs − They are used to get the logs of the container in a pod.
In Python, you can find the project id this way:
import google.auth
_, PROJECT_ID = google.auth.default()
The original question didn't mention what programming language was being used, and I had the same question for Python.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With