Using Docker on Mac, I am trying to port docker run parameters to kubernetes yaml configuration, today we are running a container with following DNS flags:
--dns="8.8.8.8" --dns="8.8.4.4"
when I do docker inspect on this container I see:
"Dns": [
"8.8.8.8",
"8.8.4.4"
]
After reading the Kubernetes docs, I configured the pod yaml like this:
dnsPolicy: "None"
dnsConfig:
nameservers:
- 8.8.8.8
- 8.8.4.4
But when I do docker inspect on the container that Kubernetes launched I see
"Dns": null
Is that expected? is the configuration correct? maybe Kubernetes networking bypasses the container configurations so the container is not aware... I simply don't know.
As fiunchinho clarified the behavior is correct. Configuring Pod DNS policy will have impact on the container, but you won't be able to see that through docker commands, like in few other cases. This is because docker and Kubernetes operate on different layers of the stack.
So adding the DNS parameter to docker run
will result in writing them in /etc/resolv.conf
and the same thing happens with adding dnsConfig
although in the last example Docker will not be aware of it. So answering the question, yes this is expected behavior.