diff --git a/pkg/cluster/internal/providers/podman/provision.go b/pkg/cluster/internal/providers/podman/provision.go index bcdd163db4..bf8dc14898 100644 --- a/pkg/cluster/internal/providers/podman/provision.go +++ b/pkg/cluster/internal/providers/podman/provision.go @@ -161,6 +161,12 @@ func commonArgs(cfg *config.Cluster, networkName string) ([]string, error) { args = append(args, "-e", fmt.Sprintf("%s=%s", key, val)) } + // handle Podman on Btrfs or ZFS same as we do with Docker + // https://github.com/kubernetes-sigs/kind/issues/1416#issuecomment-606514724 + if mountDevMapper() { + args = append(args, "--volume", "/dev/mapper:/dev/mapper") + } + return args, nil } diff --git a/pkg/cluster/internal/providers/podman/util.go b/pkg/cluster/internal/providers/podman/util.go index 853f9301a8..eb274ab247 100644 --- a/pkg/cluster/internal/providers/podman/util.go +++ b/pkg/cluster/internal/providers/podman/util.go @@ -115,3 +115,19 @@ func deleteVolumes(names []string) error { cmd := exec.Command("podman", args...) return cmd.Run() } + +// mountDevMapper checks if the podman storage driver is Btrfs or ZFS +func mountDevMapper() bool { + storage := "" + cmd := exec.Command("podman", "info", "-f", + `{{ index .Store.GraphStatus "Backing Filesystem"}}`) + lines, err := exec.OutputLines(cmd) + if err != nil { + return false + } + + if len(lines) > 0 { + storage = strings.ToLower(strings.TrimSpace(lines[0])) + } + return storage == "btrfs" || storage == "zfs" +}