Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to use local DNS to connect to postgres on Rancher Desktop #6595

Open
akashkiran-s opened this issue Mar 9, 2024 · 0 comments
Open
Assignees
Labels

Comments

@akashkiran-s
Copy link

akashkiran-s commented Mar 9, 2024

Actual Behavior

Using docker-compose, I am trying to create a DNS container which would resolve the address for a Postgres database in another container. Both of them have their ports forwarded to the host.

I have created an entry in /etc/resolver/testdomain and that is reflected on using scutil --dns

I am trying to access postgres through psql.

Steps to Reproduce

  1. Create a folder pg_dns_test
  2. Add docker-compose.yml to pg_dns_test
version: "3"

services:
    testdb:
        image: postgres:13.7
        volumes:
            - ./.postgres-data:/var/lib/postgresql/data
        restart: always
        environment:
            - POSTGRES_USER=postgres
            - POSTGRES_PASSWORD=postgres
            - POSTGRES_DB=testdb
        ports:
            - 5432:5432
        networks:
            default:
                aliases:
                    - testdb.testdomain
    dnsmasq:
        image: jpillora/dnsmasq
        restart: always
        ports:
            - "5300:53/udp"
            - "5300:53/tcp"
            - 5380:8080
        volumes:
            - ./dnsmasq.conf:/etc/dnsmasq.conf:ro
  1. Add dnsmasq.conf to pg_dns_test
log-queries
no-resolv
address=/testdomain/127.0.0.1
  1. Create a file using sudo vi /etc/resolver/testdomain having the below content
domain testdomain
nameserver 127.0.0.1
port 5300
  1. Start the containers
docker-compose up
  1. Connect to postgres in new terminal
 psql -U postgres -h testdb.testdomain  -p 5432 -d testdb
  1. Stop the containers
docker-compose down

Result

Request times out and there is no connection to postgres

Expected Behavior

On docker desktop, this setup worked without glitch

Additional Information

Output of scutil --dns

DNS configuration

resolver #1
  search domain[0] : company.com
  search domain[1] : isp.net
  nameserver[0] : 10.6.0.1             //ip changed
  nameserver[1] : 10.6.0.2
  nameserver[2] : 10.6.0.3
  flags    : Supplemental, Request A records, Request AAAA records
  reach    : 0x00030002 (Reachable,Local Address,Directly Reachable Address)
  order    : 101200

resolver #2
......
......
......

resolver #3
  domain   : company.com
  nameserver[0] : 10.6.0.1
  nameserver[1] : 10.6.0.2
  nameserver[2] : 10.6.0.3
  flags    : Supplemental, Request A records, Request AAAA records
  reach    : 0x00030002 (Reachable,Local Address,Directly Reachable Address)
  order    : 101201

resolver #4
  domain   : local
  options  : mdns
  timeout  : 5
  flags    : Request A records, Request AAAA records
  reach    : 0x00000000 (Not Reachable)
  order    : 300000

resolver #5
  domain   : ********.arpa
  options  : mdns
  timeout  : 5
  flags    : Request A records, Request AAAA records
  reach    : 0x00000000 (Not Reachable)
  order    : 300200

.......
.......
.......
.......

resolver #12
  domain   : testdomain
  nameserver[0] : 127.0.0.1
  port     : 5300
  flags    : Request A records, Request AAAA records
  reach    : 0x00030002 (Reachable,Local Address,Directly Reachable Address)

DNS configuration (for scoped queries)

resolver #1
  search domain[0] : isp.net
  nameserver[0] : 2***:*:feed::1
  nameserver[1] : 2***:*:feed::2
  nameserver[2] : ** . ** . ** . **
  nameserver[3] : ** . ** . ** . **
  if_index : 15 (en0)
  flags    : Scoped, Request A records, Request AAAA records
  reach    : 0x00000002 (Reachable)

Changed Volume settings on Rancher based on this issue & solution

Screenshot 2024-03-11 at 10 50 28 AM

Rancher Desktop Version

1.12.3

Rancher Desktop K8s Version

deactivated

Which container engine are you using?

moby (docker cli)

What operating system are you using?

macOS

Operating System / Build Version

Sonoma 14.3.1

What CPU architecture are you using?

arm64 (Apple Silicon)

Linux only: what package format did you use to install Rancher Desktop?

None

Windows User Only

No response

@akashkiran-s akashkiran-s added the kind/bug Something isn't working label Mar 9, 2024
@Nino-K Nino-K self-assigned this Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants