podman icon indicating copy to clipboard operation
podman copied to clipboard

podman kube play: emptyDir medium: Memory is not shared between init and regular containers

Open varadi-1967 opened this issue 3 months ago • 0 comments

Issue Description

When using podman kube play with a Kubernetes emptyDir volume configured as medium: Memory, the volume is mounted as tmpfs, but data written by an init container is not visible to the regular container in the same pod.

The expected Kubernetes behavior is that the emptyDir volume is shared by all containers in the pod and survives the termination of the init container.

With Podman 6.1.0-rc1, the /run/secret mount is correctly reported as tmpfs, but the data written by the init container is missing when read by the regular container.

A local patch that models the memory-backed emptyDir as a pod-scoped tmpfs volume kept mounted by the infra container fixes the issue.

Steps to reproduce the issue

  1. Use Ubuntu 24.04 with rootless Podman 6.1.0-rc1.
  2. Run ./setup-6.1.0.sh to install the unpatched Podman packages.
  3. Run ./test.sh.
  4. The test creates an isolated Podman storage, pulls busybox:latest, and runs podman kube play tmpfs-test.yaml.
  5. The init container writes Secret-Data-123 to /run/secret.
  6. The regular container reads /run/secret and reports the filesystem type and contents.
  7. Observe that /run/secret is mounted as tmpfs, but the data written by the init container is missing.
  8. The test reports: DATA: MISSING [FAIL] init data NOT shared (DATA=MISSING) — the tmpfs patch is missing

Describe the results you received

The test fails because the emptyDir tmpfs is not shared correctly between the init container and the regular container. The observed output is: DATA: MISSING FSLINE: tmpfs tmpfs 11243020 0 11243020 0% /run/secret

[FAIL] init data NOT shared (DATA=MISSING) — the tmpfs patch is missing

Describe the results you expected

The init container writes Secret-Data-123 to /run/secret, and the regular container should be able to read the same data from the same emptyDir volume.

The volume should remain available for the lifetime of the pod, and /run/secret should be backed by tmpfs with the configured 64 MiB sizeLimit.

podman info output

host:
  arch: amd64
  buildahVersion: 1.45.0
  cdiSpecDirs:
  - /etc/cdi
  - /var/run/cdi
  cgroupControllers:
  - cpu
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon_2.1.10+ds1-1build2_amd64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.10, commit: unknown'
  cpuUtilization:
    idlePercent: 89.24
    systemPercent: 1.65
    userPercent: 9.11
  cpus: 8
  databaseBackend: sqlite
  distribution:
    codename: noble
    distribution: ubuntu
    version: "24.04"
  eventLogger: journald
  freeLocks: 2048
  hostname: varadi-HP-255-G8
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 165536
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 165536
      size: 65536
  kernel: 6.8.0-137-generic
  linkmode: dynamic
  logDriver: journald
  memAvailable: 18463215616
  memFree: 9017180160
  memTotal: 23025704960
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    defaultNetwork: podman
    dns:
      package: aardvark-dns_2.1.0-1local1_amd64
      path: /usr/lib/podman/aardvark-dns
      version: aardvark-dns 2.1.0
    package: netavark_2.1.0-1local1_amd64
    path: /usr/lib/podman/netavark
    version: netavark 2.1.0
  ociRuntime:
    name: crun
    package: crun_1.29-1local1_amd64
    path: /usr/bin/crun
    version: |-
      crun version 1.29
      commit: d66af6a0fc2ab5fabd951b427a292344632ce074
      rundir: /run/user/1000/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +JSON_C
  os: linux
  pasta:
    executable: /usr/bin/pasta
    package: passt_0.0~git20260728.f8df3f1-1local1_amd64
    version: |
      pasta unknown version
      Copyright Red Hat
      GNU General Public License, version 2 or later
        <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.
  remoteSocket:
    exists: true
    path: /run/user/1000/podman/podman.sock
  rootlessNetworkCmd: pasta
  rootlessPortForwarder: rootlessport
  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: false
  serviceIsRemote: false
  swapFree: 2147479552
  swapTotal: 2147479552
  uptime: 4h 29m 25.00s (Approximately 0.17 days)
  variant: ""
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries: {}
store:
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/varadi/.local/share/containers/storage
  graphRootAllocated: 185747415040
  graphRootUsed: 100641255424
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Supports shifting: "false"
    Supports volatile: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 0
  runRoot: /run/user/1000/containers
  transientStore: false
  volumePath: /home/varadi/.local/share/containers/storage/volumes
version:
  APIVersion: 6.1.0-rc1
  Built: 1786183200
  BuiltTime: Sat Aug  8 12:00:00 2026
  GitCommit: 7cb0694778c1097a5ec8ccc7b739d81fa85aa775-dirty
  GoVersion: go1.25.9
  Os: linux
  OsArch: linux/amd64
  Version: 6.1.0-rc1

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

Yes

Additional environment details

No response

Additional information

Podman 6.0.2: Unpatched: FAIL Patched: PASS

Podman 6.1.0-rc1: Unpatched: FAIL Patched: PASS

setup-6.0.2.sh setup-6.1.0-rc1.sh

tmpfs-test.yaml test.sh

kube-emptydir-tmpfs.patch

varadi-1967 avatar Aug 17 '26 10:08 varadi-1967