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

[Bug]: DNS between two pods on the same network not working as expected #17370

Closed
thmo opened this issue Feb 6, 2023 · 3 comments · Fixed by #19193
Closed

[Bug]: DNS between two pods on the same network not working as expected #17370

thmo opened this issue Feb 6, 2023 · 3 comments · Fixed by #19193
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. network Networking related issue or feature podman-desktop

Comments

@thmo
Copy link

thmo commented Feb 6, 2023

Issue Description

The DNS with aardvark-dns between two pods connected to the same network seems to be based on the pod's name instead of the hostname.

Steps to reproduce the issue

$ podman network create test
$ podman pod  create --network test --name foo --hostname bar
$ podman run --rm -ti --pod foo alpine hostname
bar
$ podman pod  create --network test --name foo2 --hostname bar2
$ podman run --rm -ti --pod foo2 alpine hostname
bar2

$ podman run --rm -ti --pod foo2 alpine ping -c1 bar
ping: bad address 'bar'

$ podman run --rm -ti --pod foo2 alpine ping -c1 foo
PING foo (10.89.0.14): 56 data bytes
64 bytes from 10.89.0.14: seq=0 ttl=42 time=0.054 ms

--- foo ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 0.054/0.054/0.054 ms

Describe the results you received

Pinging foo from the second pod works, whereas pinging bar doesn't.

Describe the results you expected

Expected results are vice-versa: Pinging bar should work.

podman info output

host:
  arch: amd64
  buildahVersion: 1.28.0
  cgroupControllers:
  - cpuset
  - cpu
  - io
  - memory
  - hugetlb
  - pids
  - misc
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.5-1.fc37.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.5, commit: '
  cpuUtilization:
    idlePercent: 76.32
    systemPercent: 5.7
    userPercent: 17.98
  cpus: 12
  distribution:
    distribution: fedora
    variant: workstation
    version: "37"
  eventLogger: journald
  hostname: andromeda
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 6.1.8-200.fc37.x86_64
  linkmode: dynamic
  logDriver: journald
  memFree: 1487212544
  memTotal: 16673947648
  networkBackend: cni
  ociRuntime:
    name: crun
    package: crun-1.7.2-3.fc37.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.7.2
      commit: 0356bf4aff9a133d655dc13b1d9ac9424706cac4
      rundir: /run/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL
  os: linux
  remoteSocket:
    exists: true
    path: /run/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: false
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.2.0-8.fc37.x86_64
    version: |-
      slirp4netns version 1.2.0
      commit: 656041d45cfca7a4176f6b7eed9e4fe6c11e8383
      libslirp: 4.7.0
      SLIRP_CONFIG_VERSION_MAX: 4
      libseccomp: 2.5.3
  swapFree: 8472416256
  swapTotal: 8472489984
  uptime: 65h 37m 6.00s (Approximately 2.71 days)
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - docker.io
  - quay.io
store:
  configFile: /etc/containers/storage.conf
  containerStore:
    number: 1
    paused: 0
    running: 0
    stopped: 1
  graphDriverName: overlay
  graphOptions:
    overlay.mountopt: nodev,metacopy=on
  graphRoot: /var/lib/containers/storage
  graphRootAllocated: 52521566208
  graphRootUsed: 42702036992
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "true"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 1
  runRoot: /var/run/containers/storage
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 4.3.1
  Built: 1668178887
  BuiltTime: Fri Nov 11 16:01:27 2022
  GitCommit: ""
  GoVersion: go1.19.2
  Os: linux
  OsArch: linux/amd64
  Version: 4.3.1

Podman in a container

No

Privileged Or Rootless

None

Upstream Latest Release

No

Additional environment details

No response

Additional information

$ podman network inspect test

[
     {
          "name": "test",
          "id": "9d2b735d35c2946a4650fc1951a5dab1da05b273be9f9c0b51aaa60bc02a10ef",
          "driver": "bridge",
          "network_interface": "podman1",
          "created": "2023-02-06T09:24:25.771954129+01:00",
          "subnets": [
               {
                    "subnet": "10.89.0.0/24",
                    "gateway": "10.89.0.1"
               }
          ],
          "ipv6_enabled": false,
          "internal": false,
          "dns_enabled": true,
          "ipam_options": {
               "driver": "host-local"
          }
     }
]
@thmo thmo added the kind/bug Categorizes issue or PR as related to a bug. label Feb 6, 2023
@Luap99 Luap99 added the network Networking related issue or feature label Feb 6, 2023
@Luap99
Copy link
Member

Luap99 commented Feb 6, 2023

We never used the hostname as dns name, always the container/pod name.
I am not sure about docker but will double check.

Although I agree it would make sense to add the hostname as well.

@github-actions
Copy link

github-actions bot commented Mar 9, 2023

A friendly reminder that this issue had no activity for 30 days.

@benoitf
Copy link
Contributor

benoitf commented Jun 28, 2023

I am not sure about docker but will double check.

it's how docker works

Test case provided in #19025 as well

Luap99 added a commit to Luap99/libpod that referenced this issue Jul 11, 2023
We use the name as alias but using the hostname makes also sense and
this is what docker does. We have to keep the short id as well for
docker compat.

While adding some tests I removed some duplicated tests that were
executed twice for nv for no reason.

Fixes containers#17370

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
ashley-cui pushed a commit to ashley-cui/podman that referenced this issue Jul 13, 2023
We use the name as alias but using the hostname makes also sense and
this is what docker does. We have to keep the short id as well for
docker compat.

While adding some tests I removed some duplicated tests that were
executed twice for nv for no reason.

Fixes containers#17370

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Oct 10, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. network Networking related issue or feature podman-desktop
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants