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 down --force doesn't seem to work #18797

Closed
EvaristeGalois11 opened this issue Jun 5, 2023 · 3 comments · Fixed by #18814
Closed

podman kube down --force doesn't seem to work #18797

EvaristeGalois11 opened this issue Jun 5, 2023 · 3 comments · Fixed by #18814
Labels
kind/bug Categorizes issue or PR as related to a bug. kube locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@EvaristeGalois11
Copy link
Contributor

Issue Description

Hi, I'm trying to clean up a pod created with podman kube play but the volume isn't being removed.

From the official documentation:

--force

Tear down the volumes linked to the PersistentVolumeClaims as part --down

But this parameter doesn't seem to work, the pod and container are in fact removed but the volume isn't.

This is my yaml file (in the steps section below I reported all the commands that I used to generate it):

apiVersion: v1
kind: Pod
metadata:
  annotations:
    io.podman.annotations.ulimit: nofile=524288:524288,nproc=62567:62567
  creationTimestamp: "2023-06-05T19:31:08Z"
  labels:
    app: postgres-pod
  name: postgres-pod
spec:
  containers:
  - args:
    - postgres
    env:
    - name: POSTGRES_PASSWORD
      value: test
    image: docker.io/library/postgres:latest
    name: postgres
    ports:
    - containerPort: 5432
      hostPort: 5432
    volumeMounts:
    - mountPath: /var/lib/postgresql/data
      name: postgres-volume-pvc
  volumes:
  - name: postgres-volume-pvc
    persistentVolumeClaim:
      claimName: postgres-volume

The command podman kube down --force doesn't remove the volume postgres-volume even though the force parameter is used.

Steps to reproduce the issue

Steps to reproduce the issue

  1. podman run -d --name postgres -e POSTGRES_PASSWORD=test -p 5432:5432 -v postgres-volume:/var/lib/postgresql/data postgres
  2. podman kube generate postgres > postgres.yaml
  3. podman stop postgres && podman rm postgres && podman volume rm postgres-volume
  4. podman kube play postgres.yaml
  5. podman kube down --force postgres.yaml
  6. podman volume ls

Describe the results you received

podman-volume is still there

Describe the results you expected

podman-volume should be removed with the --force parameter

podman info output

host:
  arch: amd64
  buildahVersion: 1.30.0
  cgroupControllers:
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: /usr/bin/conmon è contenuto in conmon 1:2.1.7-1
    path: /usr/bin/conmon
    version: 'conmon version 2.1.7, commit: f633919178f6c8ee4fb41b848a056ec33f8d707d'
  cpuUtilization:
    idlePercent: 75.33
    systemPercent: 3.19
    userPercent: 21.47
  cpus: 8
  databaseBackend: boltdb
  distribution:
    distribution: arch
    version: unknown
  eventLogger: journald
  hostname: thinkpad
  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: 6.3.5-arch1-1
  linkmode: dynamic
  logDriver: journald
  memFree: 6488092672
  memTotal: 16438435840
  networkBackend: netavark
  ociRuntime:
    name: crun
    package: /usr/bin/crun è contenuto in crun 1.8.5-1
    path: /usr/bin/crun
    version: |-
      crun version 1.8.5
      commit: b6f80f766c9a89eb7b1440c0a70ab287434b17ed
      rundir: /run/user/1000/crun
      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: /etc/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: /usr/bin/slirp4netns è contenuto in slirp4netns 1.2.0-1
    version: |-
      slirp4netns version 1.2.0
      commit: 656041d45cfca7a4176f6b7eed9e4fe6c11e8383
      libslirp: 4.7.0
      SLIRP_CONFIG_VERSION_MAX: 4
      libseccomp: 2.5.4
  swapFree: 4294963200
  swapTotal: 4294963200
  uptime: 2h 51m 38.00s (Approximately 0.08 days)
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - docker.io
store:
  configFile: /home/claudio/.config/containers/storage.conf
  containerStore:
    number: 2
    paused: 0
    running: 2
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/claudio/.local/share/containers/storage
  graphRootAllocated: 201731903488
  graphRootUsed: 38577295360
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 2
  runRoot: /run/user/1000/containers
  transientStore: false
  volumePath: /home/claudio/.local/share/containers/storage/volumes
version:
  APIVersion: 4.5.1
  Built: 1685139594
  BuiltTime: Sat May 27 00:19:54 2023
  GitCommit: 9eef30051c83f62816a1772a743e5f1271b196d7-dirty
  GoVersion: go1.20.4
  Os: linux
  OsArch: linux/amd64
  Version: 4.5.1

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

Yes

Additional environment details

No response

Additional information

I even tried with podman kube play --down --force but it's the same thing, the volume isn't being removed.

@EvaristeGalois11 EvaristeGalois11 added the kind/bug Categorizes issue or PR as related to a bug. label Jun 5, 2023
@Luap99 Luap99 added the kube label Jun 6, 2023
@danishprakash
Copy link
Contributor

So the issue seems to be that we're not extracting volume names while tearing down during when they are part of a Pod i.e. they are not defined explicitly as a PersistentVolumeClaim kind object and hence these volumes are not removed.

The following patch[1] should take care of it, could you try it once and see if it works for you?

main...danishprakash:podman:kube-down-volrm

cc/ @Luap99

@rhatdan
Copy link
Member

rhatdan commented Jun 6, 2023

Please open a PR for this fix.

@EvaristeGalois11
Copy link
Contributor Author

Ok after almost nuking my PC lol I managed to apply your patch @danishprakash and it works!

immagine

Thanks!

danishprakash added a commit to danishprakash/podman that referenced this issue Jun 7, 2023
* add e2e test

Closes containers#18797

Signed-off-by: danishprakash <danish.prakash@suse.com>
danishprakash added a commit to danishprakash/podman that referenced this issue Jun 7, 2023
* add e2e test

Closes containers#18797

Signed-off-by: danishprakash <danish.prakash@suse.com>
danishprakash added a commit to danishprakash/podman that referenced this issue Jun 7, 2023
* add e2e test

Closes containers#18797

Signed-off-by: danishprakash <danish.prakash@suse.com>
danishprakash added a commit to danishprakash/podman that referenced this issue Jun 8, 2023
* add e2e test

Closes containers#18797

Signed-off-by: danishprakash <danish.prakash@suse.com>
danishprakash added a commit to danishprakash/podman that referenced this issue Jun 12, 2023
* add e2e test

Closes containers#18797

Signed-off-by: danishprakash <danish.prakash@suse.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 26, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 26, 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. kube locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants