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

podman kube play does not use default environment variables #2930

Closed
Fodoj opened this issue Apr 14, 2019 · 5 comments
Closed

podman kube play does not use default environment variables #2930

Fodoj opened this issue Apr 14, 2019 · 5 comments
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.

Comments

@Fodoj
Copy link
Contributor

Fodoj commented Apr 14, 2019

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

/kind bug

Description

I am using postgres image from Docker Library. If I run it just with podman run, without specifying any extra environment variables, it works fine - it picks default values for things like PGDATA, PATH etc.

But if I use pod.yaml and podman play kube, it doesn't use any default values and forces me to specify every environment variable in my pod.yaml, like this:

apiVersion: v1
kind: Pod
metadata:
  labels:
    app: mkdev-dev
  name: mkdev-dev
spec:
  containers:
  - command:
    - docker-entrypoint.sh
    - postgres
    env:
    - name: PATH
      value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/postgresql/9.6/bin
    - name: PG_VERSION
      value: 9.6.9-2.pgdg90+1
    - name: PGDATA
      value: /var/lib/postgresql/data
    - name: POSTGRES_PASSWORD
      value: secrets
    - name: GOSU_VERSION
      value: "1.10"
    - name: LANG
      value: en_US.utf8
    - name: PG_MAJOR
      value: "9.6"
    image: docker.io/library/postgres:9.6.9
    ports:
      - hostPort: 5432
        containerPort: 5432
        protocol: tcp
    name: postgres
    workingDir: /

podman generate kube outputs yaml with all possible environment variables that are needed, but it still would be nice not to specify all the internals like PATH etc directly, as I probably should not be concerned with internals of the image that much.

Steps to reproduce the issue:

  1. podman kube play pod.yaml with the above yaml, but without PGDATA or PATH

Describe the results you received:

Container fails to start, as PGDATA variable is missing

Describe the results you expected:

Container starts with default PGDATA

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

Output of podman version:

podman version 1.2.0

Output of podman info --debug:

debug:
  compiler: gc
  git commit: ""
  go version: go1.11.5
  podman version: 1.2.0
host:
  BuildahVersion: 1.7.2
  Conmon:
    package: podman-1.2.0-2.git3bd528e.fc29.x86_64
    path: /usr/libexec/podman/conmon
    version: 'conmon version 1.12.0-dev, commit: d88bb0e63cb70f9787a8e410716924f380af361f'
  Distribution:
    distribution: fedora
    version: "29"
  MemFree: 4914077696
  MemTotal: 25005699072
  OCIRuntime:
    package: runc-1.0.0-68.dev.git6635b4f.fc29.x86_64
    path: /usr/bin/runc
    version: |-
      runc version 1.0.0-rc6+dev
      commit: ef9132178ccc3d2775d4fb51f1e431f30cac1398-dirty
      spec: 1.0.1-dev
  SwapFree: 12574519296
  SwapTotal: 12574519296
  arch: amd64
  cpus: 8
  hostname: linux.fritz.box
  kernel: 5.0.4-200.fc29.x86_64
  os: linux
  rootless: false
  uptime: 360h 40m 8.78s (Approximately 15.00 days)
insecure registries:
  registries: []
registries:
  registries:
  - docker.io
  - registry.fedoraproject.org
  - quay.io
  - registry.access.redhat.com
  - registry.centos.org
store:
  ConfigFile: /etc/containers/storage.conf
  ContainerStore:
    number: 3
  GraphDriverName: overlay
  GraphOptions:
  - overlay.mountopt=nodev
  GraphRoot: /var/lib/containers/storage
  GraphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  ImageStore:
    number: 4
  RunRoot: /var/run/containers/storage
  VolumePath: /var/lib/containers/storage/volumes

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

Linux linux.fritz.box 5.0.4-200.fc29.x86_64 #1 SMP Mon Mar 25 02:27:33 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Apr 14, 2019
@haircommander haircommander self-assigned this Apr 14, 2019
@vrothberg
Copy link
Member

Thanks for the report, @Fodoj!
The issue is now fixed with #2932.

@vquemener
Copy link

Hi,

I am facing the same issue with Podman 2.2.1 on Fedora 33.

If I use the pod.yaml provided by @Fodoj, everything works as expected.

As soon as I remove one of the default environment variables (for example PGDATA), the container fails to start :

$ podman play kube pod.yaml && podman logs -f mkdev-dev-postgres
Pod:
6e3dbbdff66bb30d38cc5f0c6cac4f1ffadcc6c3a1411d082fad3f70d956e3cc
Container:
2df9077b18c8549881dc69106ba5e6b3429f5e73044e228d0bc8bf15024f3396

mkdir: cannot create directory ‘’: No such file or directory
mkdir: cannot create directory ‘’: No such file or directory
mkdir: cannot create directory ‘’: No such file or directory
[...]

Should I open another issue?

@vquemener
Copy link

vquemener commented Feb 22, 2021

Oh, nevermind, it looks like this was fixed for podman 3.0.0 in #8654.

I will have to wait for Fedora 34!

@baude
Copy link
Member

baude commented Feb 22, 2021

it will come out in f33

@vquemener
Copy link

Thanks @baude, that's good news!

@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 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 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
Development

No branches or pull requests

6 participants