Set App (ie: Kubernetes Pod) Hostname

HarryMuscle

Contributor
Joined
Nov 15, 2021
Messages
161
Is it possible to set the hostname for a Kubernetes pod in TrueNAS Scale? I didn't see it in the GUI so I'm hoping it's possible to set it via the API.

I need to get the pod IP address (not the service IP address, that's possible without a hostname) from a second pod using a domain name and as far as I can tell that's only possible if you set the hostname on the first pod.

Thanks,
Harry
 

waqarahmed

iXsystems
iXsystems
Joined
Aug 28, 2019
Messages
136
@HarryMuscle can i ask what you want to do basically ? It seems you want to communicate between 2 different apps but in that case you should be using services instead of finding out pod ip addresses as they are bound to change
 

HarryMuscle

Contributor
Joined
Nov 15, 2021
Messages
161
@HarryMuscle can i ask what you want to do basically ? It seems you want to communicate between 2 different apps but in that case you should be using services instead of finding out pod ip addresses as they are bound to change
I ended up finding a different solution, but basically what I was trying to do is find the source IP for pod A from pod B so that I can whitelist that IP in pod B. The best approach seemed to be to do this via the DNS, however, it only provides the service IP address (unless you set a static hostname on the pod) but the source IP for communications is the pod IP address not the service IP address.

Thanks,
Harry
 

truecharts

Guru
Joined
Aug 19, 2021
Messages
788
you should whitelist:
172.16.0.0/16

If you want to block other apps from communicating, Kubernetes uses networkPolicies instead.
 
Top