Search code examples
amazon-web-servicesdockerkubernetes

kubernetes on AWS get region name in pod


I am running a kubernetes cluster on AWS-ec2 and I would like to have the pod (container) know during runtime which region it's running on, how can this be done?


Solution

  • There are a few suggestions in this similar question: Inject node labels into Kubernetes pod

    Options:

    1. Sidecar container that queries the Kubernetes API
    2. Place a data/configuration file on each node containing the region info