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

Mount Propogation not working as expected(/var, /var:shared and /mnt/s3data are not in sync) #6

Open
Sud369 opened this issue Jul 6, 2023 · 1 comment

Comments

@Sud369
Copy link

Sud369 commented Jul 6, 2023

    command: ["./goofys", "-f", "mybucket3", "/var"]
    securityContext:
      privileged: true
    volumeMounts:
    - name: s3data
      mountPath: /var:shared
    env:
      - name: S3_BUCKET
        value: mybucket3
      - name: MOUNT_PATH
        value: /var
  volumes:
  - name: s3data
    hostPath:
      path: /mnt/s3data

===========================================================
With the following lines in daemonset.yaml
/var is mounted with s3 (i.e. changes made in s3 is reflected in /var folder in container and vice versa)
/var:shared is mounted with /mnt/s3data (i.e changes made in /var:shared folder in container is reflected in host and vv)
However /var , /var:shared and s3 bucket is not in sync.
Probably mount Propagation is not working as expected.
Kindly suggest in case of any suggestion or possible workarounds/solutions.

@renierwoo
Copy link

Hi!

I have experienced the same behavior but with the mountpoint-s3 application (from awslabs). I was able to get it working by doing the following:

[DaemonSet]
...
spec:
  containers:
    - name: <example.app>
       image: <example.repo>
       command:
          - '/bin/sh'
          - '-c'
       args:
          - |
            mkdir -p /var/s3data/bucket && /mount-s3 -f --auto-unmount <example.bucket> /var/s3data/bucket
       volumeMounts:
         - name: mys3data
           mountPath: /var/s3data
           mountPropagation: Bidirectional
       securityContext:
         privileged: true
         capabilities:
           add:
           - SYS_ADMIN
  volumes:
    - name: mys3data
       hostPath:
         path: /mnt/mys3data
  serviceAccount: example.serviceAccount
...

You should try making a mount point in /var (the directory that will map to the host directory /mnt/s3data) without using :shared. In the command section, first generate the directory where the s3 bucket will be mounted, which must be inside /var (e.g /var/bucket) because when the daemonset makes the mount point /var it overlaps the content from /var folder inside the container . In the section volumeMounts you need to add mountPropagation: Bidirectional to convey with Mount Propagation by Kubernetes

So I think if you can translate it to your scenario, maybe it will work for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants