local-path-provisioner icon indicating copy to clipboard operation
local-path-provisioner copied to clipboard

Storage class configured for shared volumes does not syncronize between nodes

Open zad80 opened this issue 1 year ago • 1 comments

I've deployed rancher local path provisioner v0.0.28 on a k8s cluster via helm and configured with the configMap options:

kind: ConfigMap
apiVersion: v1
metadata:
  name: local-path-config
  namespace: "{{ .Release.Namespace }}"
data:
  config.json: |-
    {
           "storageClassConfigs":{
             "local-path": {
                    "nodePathMap": [
                    {
                            "node":"DEFAULT_PATH_FOR_NON_LISTED_NODES",
                            "paths":["/opt/local-path-provisioner"]
                    }
                    ]
             },
             "local-path-shared": {
                    "sharedFilesystemPath": "/opt/local-path-provisioner-shared"
             }
            }
    }
  setup: |-
    #!/bin/sh
    set -eu
    mkdir -m 0777 -p "$VOL_DIR"
  teardown: |-
    #!/bin/sh
    set -eu
    rm -rf "$VOL_DIR"
  helperPod.yaml: |-
    apiVersion: v1
    kind: Pod
    metadata:
      name: helper-pod
    spec:
      priorityClassName: system-node-critical
      tolerations:
        - key: node.kubernetes.io/disk-pressure
          operator: Exists
          effect: NoSchedule
      containers:
      - name: helper-pod
        image: busybox
        imagePullPolicy: IfNotPresent

I've also create the storage class:

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: local-path-shared
provisioner: rancher.io/local-path
volumeBindingMode: Immediate
reclaimPolicy: Delete

And finally used on a pvc:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: shared-vol
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 10Gi
  storageClassName: "local-path-shared"

The main problem is that when I create a pvc the pvc directory is correctly created on all nodes, but the content isn't syncronized. i.e A pod on node-1 touch a file named test.txt, but on node-1+X the test.txt files isn't created.

Did I missed something or this is the expected behavior ?

zad80 avatar Aug 09 '24 08:08 zad80