Skip to content

Shared folder inotify issue with multiple containers on EKS using gVisor #11326

Closed
@NahumLitvin

Description

@NahumLitvin

Description

I encountered an issue when running a Pod with two containers sharing a folder in a Kubernetes cluster using gVisor. The expected behavior is for one container to detect file changes in the shared folder made by the other container, and send an event when a file is modified. However, this works as expected on GKE, but fails on EKS using the latest version of gVisor.

it is similar to #8089
but i see it works on GKE


Additional Information

  • Assumption: This issue is likely related to inotify, which chokidar relies on for file change detection.
  • Environment Details:
    • gVisor version: 20241217.0
    • EKS Kubernetes version: 1.30 (gvisor is installed with default settings)
    • GKE Kubernetes version: 1.30

Debugging Done

  1. Verified that changes to the shared folder are visible within both containers using stat and cat.
  2. Tested on GKE and confirmed that the issue does not occur there.
  3. Attempted enabling polling mode in chokidar, which bypasses inotify, and confirmed that events are then detected correctly, suggesting the issue lies with inotify.

Request

Please investigate why inotify-based file change detection in shared folders fails on EKS with gVisor, but works on GKE.

Let me know if further details or logs are required. Thank you!


This format should provide enough clarity and context for the maintainers to understand and replicate the issue.

Steps to reproduce

  1. Environment Setup:

    • Kubernetes cluster running on EKS with gVisor installed.
    • Pod specification:
      • Two containers.
      • Shared folder mounted as a volume.
    • chokidar library in Node.js is used to listen for file changes. This library relies on inotify.
  2. Pod Configuration:

    apiVersion: v1
    kind: Pod
    metadata:
      name: shared-folder-test
    spec:
      runtimeClassName: gvisor
      containers:
      - name: container1
        image: node:14
        command: ["node", "watcher.js"]
        volumeMounts:
        - name: shared-folder
          mountPath: /shared
      - name: container2
        image: busybox
        command: ["/bin/sh", "-c", "while true; do echo 'hello' > /shared/test.txt; sleep 2; done"]
        volumeMounts:
        - name: shared-folder
          mountPath: /shared
      volumes:
      - name: shared-folder
        emptyDir: {}
  3. Container 1 Code (watcher.js):

    const chokidar = require('chokidar');
    
    const watcher = chokidar.watch('/shared', {
      persistent: true,
    });
    
    watcher.on('change', (path) => {
      console.log(`${path} changed`);
    });
  4. Expected Behavior:

    • Container 1 logs changes to /shared/test.txt every time container 2 modifies the file.
  5. Observed Behavior:

    • On EKS with gVisor, no changes are detected by chokidar when container 2 modifies the file.
    • On GKE with gVisor, chokidar detects changes correctly.

runsc version

runsc version release-20241217.0
spec: 1.1.0-rc.1

docker version (if using docker)

uname

Linux ip-10-59-118-142.ec2.internal 5.10.226-214.880.amzn2.x86_64 #1 SMP Tue Oct 8 16:18:15 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

kubectl (if using Kubernetes)

Client Version: v1.31.4
Kustomize Version: v5.4.2
Server Version: v1.30.7-eks-56e63d8

repo state (if built from source)

No response

runsc debug logs (if available)

Metadata

Metadata

Assignees

Labels

type: bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions