DNS server in docker behind LVS direct routing ?
As we're struggeling with the small packet performance of virtual DNS-servers in RHEV, I'm wondering if running them in docker containers would be a better option.
So, today we have 2x LVS routers routing DNS to 2 "real servers". The LVS router is configured as:
-A -u x.y.z.4:53 -s wrr
-a -u x.y.z.4:53 -r x.y.z.5:53 -g -w 1
-a -u x.y.z.4:53 -r x.y.z.6:53 -g -w 1
and the real-servers (x.y.z.5 and x.y.z.6) has the service address x.y.z.4 configured on the loopback interface. This works fine (except for performance issues under high load).
Now I would like to do the same with docker for the real servers. Does anybody have any suggestion for how to configure the network in the docker containers to achieve this? Will NAT from host scale to 10s of thousands connections per second?
I believe as a minimum I will need the service address bound to the loopback interface in the container, so I now naively tried doing "RUN ip address add 1.2.3.4/32 dev lo" from a Dockerfile, but got "RTNETLINK answers: Operation not permitted". Get the same from within a running container, unless I run it with "--privileged=true".
Responses
Jan-Frode,
To clarify.
You want to run a DNS service in docker containers.
Each physical host (3 in the above example) will be receiving DNS traffic on their external interface (x.y.z.5, x.y.z.6)
You want the DNS traffic that hits the (x.y.z.5/6) hosts forwarded to the DNS services running in the docker container hosted on that host.
So you want to expose 53 from the docker container, and forward any traffic that hits the host on 53 to that exposed port in the docker container?
Or have I missed something major?
Hi Jan-Frode,
You can expose port 53 on the container running on docker-host to receive traffic.
However if you do want to assign ip address 1.2.3.4/32 to the interface "lo" without running the container in privileged mode, here is how you can do it.
NOTE : All commands below to be run on the docker host.
1) Run the container. Learn the containers PID
sudo docker inspect -f '{{.State.Pid}}'
e.g.
$sudo docker inspect -f '{{.State.Pid}}' 63f36fc01b5f
9634
2) create its namespace entry in /var/run/netns/
for the "ip netns" command
$ pid=9634
$ sudo mkdir -p /var/run/netns
$ sudo ln -s /proc/$pid/ns/net /var/run/netns/$pid
3) Add the IP address to the device (in this case "lo")
$ sudo ip netns exec $pid ip addr add 1.2.3.4/32 dev lo
4) Run "ip addr" command within the container and you should see the device "lo" having the above IP address.
-Vivek