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?
Take a look at AWS Instance Metadata:
[...] instance metadata is available from your running instance, you do not need to use the Amazon EC2 console or the AWS CLI. This can be helpful when you're writing scripts to run from your instance
You can query the region of a given container querying the metadata from inside during runtime. Like this:
curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone
placement/availability-zone: The Availability Zone in which the instance launched.
Get the details of the nodes and you will be able to see the region of the nodes
kubectl get nodes -A
There are a few suggestions in this similar question: Inject node labels into Kubernetes pod
Options: