Open jaasimpolin01 opened 1 year ago
This is a big need for me, thanks!
A big need for us as well. Is there a timeline provided for this?
I find a possible workaround, I don't think if it is right, but I hope that it could help.
I use Linux container, I just copy /etc/hosts
file, update and paste back.
echo ""
echo "Before."
cat /etc/hosts
echo "Check address on ETH0"
ipAddress=$(ifconfig eth0 | grep 'inet' | cut -d: -f2 | awk '{print $2}')
echo "IP Address of ETH0"
echo $ipAddress
cp -v /etc/hosts ~/hosts
echo "$ipAddress $ACI_FQDN" >> ~/hosts
cp -v ~/hosts /etc/hosts
echo ""
echo "After. Print result"
cat /etc/hosts
The output
Before.
127.0.0.1 localhost
127.0.0.1 SandboxHost-638469583236024409
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
IP Address of ETH0
192.168.0.123
'/etc/hosts' -> '/root/hosts'
'/root/hosts' -> '/etc/hosts'
After.
127.0.0.1 localhost
127.0.0.1 SandboxHost-638469583236024409
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
192.168.0.123 Here-My-ACI_FQDN
I've tried using @kallsu's suggested solution. It works well when using a single container but when there's also a sidecar present as part of the pod it seems like the hostfile gets overwritten again so the new entries aren't visible. I'd imagine this is because Container Apps is modifying the hostfile after both containers in the pod have started.
It would be great to have HostAliases exposed from the underlying Kubernetes instance, but I'd settle for a filthy workaround too.
I was able to make it work with azure private dns zone. It is not very complex or expensive like setting up a custom DNS server
Private DNS Zone works fine
Is your feature request related to a problem? Please describe.
We are not able to resolve private ip addresses from services that use internal hostnames.
Describe the solution you'd like.
It would be useful if we could have an override of hostname resolution when private DNS and other options are not applicable. Kubernetes have HostAliases that allow custom entries to be added in the /etc/hosts file of the container. A similar implementation would help to solve issues when a simple hostname mapping is required instead of having to setup a custom/private dns server.
Describe alternatives you've considered.
None