efrecon / docker-s3fs-client

Alpine-based s3fs client: mount from container, make available to other containers
BSD 3-Clause "New" or "Revised" License
181 stars 64 forks source link

Does anyone able to umount automcatically successfully in k8s? #54

Open grapemix opened 8 months ago

grapemix commented 8 months ago

I also experienced the "transport endpoint is not connected" problem for my k8s cluster and I am unable to umount my mount point from the host. However, I would like to make the recovery process automatically. Here is my trial:

      initContainers:
        - name: umount
          image: efrecon/s3fs:1.93
          command: ["sh", "-euxc", "! mountpoint -q \"${MY_MOUNT_PATH}\" | umount ${MY_MOUNT_PATH}"]
          securityContext:
            privileged: true

The idea is to umount the fs if it is being mounted before the pod get started. Unfortunately, it doesn't work. Please let us know if anyone has better idea. Thx.

ps: I also try thinks like the code below or its variation. All trials fail.

mountpoint -q \"${MY_MOUNT_PATH}\" && fusermount -u ${MY_MOUNT_PATH} || exit 0
efrecon commented 8 months ago

I don't have easy access to a k8s cluster -- I know I can create a local one, but that requires some setup. I've marked this with a request for help if someone wants to pick it up. But: could it be because you are using a different user? https://github.com/efrecon/docker-s3fs-client/blob/28d76404d0888d2bd9c4c29d9fea1d41aab17e4d/docker-entrypoint.sh#L111

grapemix commented 8 months ago

Thanks for your help. My initContainers and containers both set privileged as true. I confirm the settings by ssh to the pod, run whoami and get root. So I think both of my initContainers and containers both as the same user. BTW, I also confirm I can the above cmd from my physical host.

ps: I did set UID and GID as another user in env var, but I don't think these env vars are related.