Is it possible to set pod hostname...?

Hello World!

I’m working with a deployment manifest with more than 3 replicas, is it possible to set pod hostname dynamically and then pass it as Environment variable to be consumed by the application???

Kubernetes version: 1.13
Cloud being used: AWS EKS

thanks :slight_smile:

Pod have a hostname field. You can read your own hostname by running “hostname”.

I’m answering my own question for future readers

Kubernetes already set hostname dynamically and it’s ready to be “consumed” right away.
What I did was to create a shell script with the command hostname in it and created the desired configuration file with the value of the previous command. NOTE: this will only work in a Linux container