0

Is there a way to get the name of the cluster within the pod. Is there a fieldRef that can be used to pass on the cluster name to the pod while creating the pod using the deployment.yaml file?

Balachandar
  • 1,538
  • 3
  • 16
  • 25
  • Where do you run your K8s? There is a way to do it in GKE, not sure about the other clouds. – jabbson Dec 02 '21 at 02:58
  • The cluster doesn't know its own name. In addition to this statement, answers to the linked question also describe how to find the GKE name as @jabbson suggests, if you're in that environment, and has lots of suggestions to use `kubectl config current-context`, which won't work in-cluster (and doesn't return a stable name in any case). – David Maze Dec 02 '21 at 11:40

0 Answers0