Closed nsmith5 closed 6 years ago
How DNS resolution works exactly with Kubernetes ? Can you reach other containers with their name from mail server ? What is the default name given by Kubernetes to mariadb container ? Can you reach Kubernetes internal DNS resolver ? Can you provide me an example of resolv.conf generated by Kubernetes ?
Maybe, @fa-at-pulsit will probably have more information on that.
added 'dig search' option for cluster ip resolving (important for k8s) #243
Think I found the problem. The dig search
option should quote DBHOST
:
Currently, on line 302 of run.sh:
IP=$(dig A ${DBHOST} +short +search)
should be,
IP= $(dig A "$DBHOST" +short +search)
If I open a shell in affected container I get:
$ echo $DBHOST
{:-mariadb}
$ echo "$DBHOST"
mariadb
$ dig A $DBHOST +short +search # Doesn't work
$ dig A "$DBHOST" +short +search # works..
10.x.x.x
How does DNS for services work with docker-compose? Are the service added to /etc/hosts
so this DNS lookup is omitted?
Nevermind! The quoting was an unrelated human error. DNS lookup issue is related to using hostNetwork: true
on Kubernetes. Switching to hostPort
should fix this. Sorry for the noise!
Classification
Reproducibility
Docker information
Running on kubernetes so probably not as relevant, but here it is:
Description
If
DBHOST
is not specified, dns lookup of the defaultDBHOST
(mariadb) fails in a kubernetes environment.Steps to reproduce
Expected results
Finds mariadb service
Actual results
Does find service, DNS lookup fails
Debugging information
Configuration (docker-compose.yml, traefik.toml...etc)
Will attach soon...