Error: ENOENT: no such file or directory, mkdir '/home/node/.cache'

While setting up the N8N in Kubernetes, I am getting below error.
Error: ENOENT: no such file or directory, mkdir ‘/home/node/.cache’

Using the image n8n:1.97.1

Below is my volumemount configuration.

spec:
containers:

  • name: n8n
    env:
    • name: N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS
      value: “false”
    • name: N8N_RUNNERS_ENABLED
      value: “true”
    • name: N8N_PORT
      value: “5678”
    • name: DB_POSTGRESDB_SSL_ENABLED
      value: “true”
    • name: DB_TYPE
      value: postgresdb
    • name: DB_POSTGRESDB_DATABASE
      value: n8n
    • name: DB_POSTGRESDB_PORT
      value: “5432”
    • name: DB_POSTGRESDB_USER
      value:
    • name: DB_POSTGRESDB_HOST
      value: <postgres_host>
    • name: DB_POSTGRESDB_SCHEMA
      value: <db_schema>
    • name: DB_POSTGRESDB_PASSWORD
      valueFrom:
      secretKeyRef:
      key: secret
      name: <secret_name>
      image: <image_name>
      imagePullPolicy: IfNotPresent
      livenessProbe:
      failureThreshold: 3
      httpGet:
      path: /
      port: 5678
      scheme: HTTP
      initialDelaySeconds: 30
      periodSeconds: 30
      successThreshold: 1
      timeoutSeconds: 20
      ports:
    • containerPort: 5678
      protocol: TCP
      readinessProbe:
      failureThreshold: 60
      httpGet:
      path: /
      port: 5678
      scheme: HTTP
      initialDelaySeconds: 30
      periodSeconds: 20
      successThreshold: 1
      timeoutSeconds: 20
      resources:
      limits:
      cpu: “2”
      memory: 2Gi
      requests:
      cpu: “1”
      memory: 1Gi
      securityContext:
      allowPrivilegeEscalation: false
      readOnlyRootFilesystem: true
      terminationMessagePath: /dev/termination-log
      terminationMessagePolicy: File
      volumeMounts:
    • mountPath: /home/node/.n8n
      name: csi-n8n-pvc
      volumes:
  • name: csi-n8n-pvc
    persistentVolumeClaim:
    claimName: csi-n8n-pvc
  • emptyDir: {}
    name: n8n-plugins

It appears that the mkdir execution is failing. It could be either when the parent folder does not exist or if it is not writable. I assume in your case the reason could be the latter due to readOnlyRootFilesystem: true. I’d suggest you try to define writable mounts and add them to the spec.

I cannot the change readOnlyRootFilesystem to false as it is mandated by my organization. Any other suggestion or solution please?

This is fixed after adding empty mount as below. Also the mount path changed.

volumeMounts:
- name: csi-n8n-pvc
mountPath: /home/node
volumes:
- name: csi-n8n-pvc
emptyDir: {}

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.