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

No way to control /etc/hosts in podman play kube #9500

Closed
gcs278 opened this issue Feb 24, 2021 · 8 comments · Fixed by #9527 or #11707
Closed

No way to control /etc/hosts in podman play kube #9500

gcs278 opened this issue Feb 24, 2021 · 8 comments · Fixed by #9527 or #11707
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.

Comments

@gcs278
Copy link

gcs278 commented Feb 24, 2021

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

/kind bug

Description

podman play kube does not have YAML or runtime options to set --no-hosts (like podman pod create). Therefore, it always the same /etc/hosts as the host, even if you have isolated (non-host) networking. Kubernetes does not shared the /etc/hosts file by default.

This is a problem for me since I need to isolate the /etc/hosts file and have no way to control it.

Steps to reproduce the issue:

  1. podman play kube

Describe the results you received:

POD Containers always has /etc/hosts from the host

Describe the results you expected:

Ability to control whether /etc/hosts is the same as the host's /etc/hosts

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

Output of podman version:

Version:      2.2.1
API Version:  2
Go Version:   go1.14.7
Built:        Mon Feb  8 16:19:06 2021
OS/Arch:      linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.18.0
  cgroupManager: systemd
  cgroupVersion: v1
  conmon:
    package: conmon-2.0.21-3.module_el8.4.0+581+8bd31022.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.0.21, commit: 4cff974a37907e701aa2e31ad480ccc6f3f586f5'
  cpus: 10
  distribution:
    distribution: '"rhel"'
    version: "8.2"
  eventLogger: file
  hostname: rhel82
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 4.18.0-193.el8.x86_64
  linkmode: dynamic
  memFree: 1504854016
  memTotal: 3884625920
  ociRuntime:
    name: runc
    package: runc-1.0.0-65.rc10.module+el8.2.0+5762+aaee29fb.x86_64
    path: /usr/bin/runc
    version: 'runc version spec: 1.0.1-dev'
  os: linux
  remoteSocket:
    exists: true
    path: /run/podman/podman.sock
  rootless: false
  slirp4netns:
    executable: ""
    package: ""
    version: ""
  swapFree: 3776471040
  swapTotal: 4190105600
  uptime: 2195h 35m 53.54s (Approximately 91.46 days)
  search:
  - registry.access.redhat.com
  - registry.redhat.io
  - docker.io
store:
  configFile: /etc/containers/storage.conf
  containerStore:
    number: 11
    paused: 0
    running: 5
    stopped: 6
  graphDriverName: overlay
  graphOptions:
    overlay.mountopt: nodev,metacopy=on
  graphRoot: /var/lib/containers/storage
  graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "true"
  imageStore:
    number: 12
  runRoot: /var/run/containers/storage
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: "2"
  Built: 1612819146
  BuiltTime: Mon Feb  8 16:19:06 2021
  GitCommit: ""
  GoVersion: go1.14.7
  OsArch: linux/amd64
  Version: 2.2.1

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

podman-2.2.1-7.module+el8.3.1+9857+68fb1526.x86_64

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide?

Yes

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

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Feb 24, 2021
@rhatdan
Copy link
Member

rhatdan commented Feb 24, 2021

So should the infra container default to --nohost

@rhatdan
Copy link
Member

rhatdan commented Feb 24, 2021

@haircommander WDYT?

@haircommander
Copy link
Collaborator

haircommander commented Feb 24, 2021

infra container should have --nohost if we're not using hostNetwork in the pod YAML

@gcs278
Copy link
Author

gcs278 commented Feb 25, 2021

I see a no_hosts parameter in the containers.conf, but I've tried it multiple times with podman play kube and podman run, and it doesn't seem to change anything.

Can you guys think of a work around for the time being?

rhatdan added a commit to rhatdan/podman that referenced this issue Feb 26, 2021
Since we have no good way to enable this on the server side, we will
just allow it to be set on the client side. This should solve almost all
cases.

Partially fixes: containers#9500

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
@gcs278
Copy link
Author

gcs278 commented Mar 7, 2021

Okay so that commit seems like it fixed the no_hosts in container.conf problem, but has the problem of not being able to control the /etc/hosts file from podman play kube been addressed?

Not sure if I agree this should be closed yet - seems like we fixed an accessory problem, but not the root cause.

@mheon
Copy link
Member

mheon commented Mar 7, 2021

Concur, reopening

@mheon mheon reopened this Mar 7, 2021
@github-actions
Copy link

github-actions bot commented Apr 7, 2021

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

@flouthoc
Copy link
Collaborator

flouthoc commented Sep 24, 2021

@gcs278 Just curious how are you planning to populate this with relevant entries? Are you planning to bake /etc/host in image ? or plan to populate via hostAliases in spec ?

rhatdan added a commit to rhatdan/podman that referenced this issue Oct 1, 2021
This option will setup the containers to not modify their /etc/hosts
file and just use the one from the image.

Fixes: containers#9500

Signed-off-by: Daniel J Walsh <dwalsh@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 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
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.
Projects
None yet
6 participants