Multiple containers need to integrate with a remote API. We access the remote API using a domain name. The domain name is mapped to an IP in the hosts file, so it can map the domain name to an IP. But when it communicates with the IP (if I understand correctly) it still uses the domain name by passing it along to the IP in the “host” header - thereby triggering the correct virtual host at the remote API.
So, sure, I can give my multiple containers in Kubernetes the required “hostAliases” entry.
This will lead to the required “hostAliases” having to be duplicated across containers.
Will it be possible to encapsulate this remote API into a service and still have it pass the relevant domain name when integrating with the remote API? In other words - instead of specifying “hostAliases” let the containers integrate with a single service that then passes the domain name to the remote API inside the “hosts” header.
I looked at a “Service and Endpoint combination”, but that maps a service name to an IP. I also had a look at “ExternalName” and that seeps to map a service name to a domain name. So it doesn’t currently seem like I can do and should stick with using “hostAliases” but I just wanted to check.
Thank you kindly
Kubernetes version: 1.14.6
Cloud being used: None, still just working on my local (MicroK8s in a Ubuntu VirtualBox)
Installation method: As per MicroK8s documentation
Host OS: Windows 10 (running MicroK8s in a Ubuntu VirtualBox)
CNI and version:
CRI and version: