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

Port Forwarding for Pods on OS X not working on Host (But does in postman machine VM) #12207

Closed
convexset opened this issue Nov 8, 2021 · 5 comments · Fixed by #12222
Closed
Assignees
Labels
In Progress This issue is actively being worked by the assignee, please do not work on this at this time. 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. machine

Comments

@convexset
Copy link

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

On OS X, the port mapping for pods does not work on the host machine like it does for containers.

Interestingly, or expectedly, port mapping works correctly inside the podman machine VM.

See below:

❯ podman -v
podman version 3.4.1

❯ uname -a
Darwin hostname-here 21.1.0 Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:23 PDT 2021; root:xnu-8019.41.5~1/RELEASE_X86_64 x86_64

Creating a container on the host. Port mapping is fine:

❯ podman run -d -p 8080:80 --name myapp docker.io/library/nginx
7f6fd2903c28bf187dc4e88f9eceedafff5315b48a972999236ab35570f26d0c

❯ curl localhost:8080
<h1>Welcome to nginx!</h1>

❯ podman rm -f $(podman ps -a --quiet)
7f6fd2903c28

Creating a pod on the host. Port mapping is messed up (accessible from within the podman machine VM):

❯ podman pod create --name mypod -p 8080:80
307e963bbfec30d029c0ce7c0292b89c445956231e02a9b3f931dfe202a8cb9d

❯ podman create --pod mypod --name myapp docker.io/library/nginx
975a7a252cc64ef7e9d35ec0a67daaa2d2099d9e29476d1b0d7c64b052f6ae93

❯ podman pod start mypod
307e963bbfec30d029c0ce7c0292b89c445956231e02a9b3f931dfe202a8cb9d

❯ curl localhost:8080
curl: (7) Failed to connect to localhost port 8080: Connection refused

❯ podman machine ssh

Connecting to vm podman-machine-default. To close connection, use `~.` or `exit`
Fedora CoreOS 34.20211031.2.0
Tracker: https://github.com/coreos/fedora-coreos-tracker
Discuss: https://discussion.fedoraproject.org/c/server/coreos/

Last login: Sun Nov  7 19:01:45 2021 from 192.168.127.1
[core@localhost ~]$ curl localhost:8080
<h1>Welcome to nginx!</h1>

Steps to reproduce the issue:

(See above.)

Describe the results you received:

Port mapping for pods does not work on host, but does in the podman machine VM.

Describe the results you expected:

Port mapping for pods works on host, and also in the podman machine VM.

Additional information you deem important (e.g. issue happens only occasionally):

Output of podman version:


Client:
Version:      3.4.1
API Version:  3.4.1
Go Version:   go1.17.2
Built:        Wed Oct 20 05:14:42 2021
OS/Arch:      darwin/amd64

Server:
Version:      3.4.1
API Version:  3.4.1
Go Version:   go1.16.8
Built:        Wed Oct 20 22:35:28 2021
OS/Arch:      linux/amd64

Output of podman info --debug:


host:
  arch: amd64
  buildahVersion: 1.23.1
  cgroupControllers:
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.0.30-2.fc34.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.0.30, commit: '
  cpus: 1
  distribution:
    distribution: fedora
    variant: coreos
    version: "34"
  eventLogger: journald
  hostname: localhost
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 5.14.14-200.fc34.x86_64
  linkmode: dynamic
  logDriver: k8s-file
  memFree: 119128064
  memTotal: 2061860864
  ociRuntime:
    name: crun
    package: crun-1.2-1.fc34.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.2
      commit: 4f6c8e0583c679bfee6a899c05ac6b916022561b
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    exists: true
    path: /run/user/1000/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: true
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: true
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.1.12-2.fc34.x86_64
    version: |-
      slirp4netns version 1.1.12
      commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
      libslirp: 4.4.0
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.0
  swapFree: 0
  swapTotal: 0
  uptime: 23h 52m 31.87s (Approximately 0.96 days)
plugins:
  log:
  - k8s-file
  - none
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries:
  search:
  - docker.io
store:
  configFile: /var/home/core/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /var/home/core/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 6
  runRoot: /run/user/1000/containers
  volumePath: /var/home/core/.local/share/containers/storage/volumes
version:
  APIVersion: 3.4.1
  Built: 1634740528
  BuiltTime: Wed Oct 20 14:35:28 2021
  GitCommit: ""
  GoVersion: go1.16.8
  OsArch: linux/amd64
  Version: 3.4.1

Package info (e.g. output of rpm -q podman or apt list podman):


❯ brew info podman
podman: stable 3.4.1 (bottled), HEAD
Tool for managing OCI containers and pods
https://podman.io/
/usr/local/Cellar/podman/3.4.1 (170 files, 39.5MB) *
  Poured from bottle on 2021-11-07 at 03:29:33
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/podman.rb
License: Apache-2.0
==> Dependencies
Build: go ✔, go-md2man ✘
Required: qemu ✔
==> Options
--HEAD
	Install HEAD version
==> Caveats
zsh completions have been installed to:
  /usr/local/share/zsh/site-functions

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/master/troubleshooting.md)

Yes

Additional environment details (AWS, VirtualBox, physical, etc.):

❯ podman -v
podman version 3.4.1

❯ uname -a
Darwin hostname-here 21.1.0 Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:23 PDT 2021; root:xnu-8019.41.5~1/RELEASE_X86_64 x86_64
@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Nov 8, 2021
@Luap99
Copy link
Member

Luap99 commented Nov 8, 2021

Can you provide the output of podman inspect $(podman pod inspect --format {{.InfraContainerID}} mypod)

@Luap99
Copy link
Member

Luap99 commented Nov 8, 2021

I think it should work when you create the pod with podman pod create --name mypod -p 8080:80 --network bridge

@Luap99 Luap99 self-assigned this Nov 8, 2021
@Luap99 Luap99 added the In Progress This issue is actively being worked by the assignee, please do not work on this at this time. label Nov 8, 2021
@Luap99
Copy link
Member

Luap99 commented Nov 8, 2021

PR #12222 should fix it

@convexset
Copy link
Author

podman pod create --name mypod -p 8080:80 --network bridge

does make things work.

However, it may be something that has to be addressed anyhow.

(I take it that the --network bridge option is hiding somewhere?)

@Luap99
Copy link
Member

Luap99 commented Nov 8, 2021

--network bridge is set via config for podman machine
podman pod create just didn't read the config value

Luap99 added a commit to Luap99/libpod that referenced this issue Nov 8, 2021
When we create a pod we have to parse the network mode form the config
file. This is a regression in commit d28e857.

Fixes containers#12207

Signed-off-by: Paul Holzinger <[email protected]>
Luap99 added a commit to Luap99/libpod that referenced this issue Nov 11, 2021
When we create a pod we have to parse the network mode form the config
file. This is a regression in commit d28e857.

Fixes containers#12207

Signed-off-by: Paul Holzinger <[email protected]>
@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 Sep 21, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
In Progress This issue is actively being worked by the assignee, please do not work on this at this time. 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. machine
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants