I have an issue with the DNS mapping in kubernetes.
We have some servers which can be accessed from internet. The global DNS translates these servers's domain names to public internet IPs. Some services can't access through public IPs for security consideration.
From company internal, we add the DNS mappings with private IPs to /etc/hosts inside docker containers managed by kubernetes to access these servers manually.
I know that docker supports command --add-host to change /etc/hosts
when executing docker run
. I'm not sure if this command supported in latest kubernetes, such as kuber 1.4
or 1.5
?
On the other hand, we can wrap the startup script for the docker container,
- append the mappings to
/etc/hosts
firstly - start our application
I only want to change the file once after first run in each container. Is there an easy way to do this because the mapping relations maybe different between develop and production environments or any commands related to this provided by kubernetes itself?