Skip to content

Conversation

@loverustfs
Copy link
Collaborator

🐛 Bug Fix

This PR addresses the "Permission denied" issue reported in rustfs/rustfs#987 when bootstrapping clusters on storage backends like Longhorn or local paths where default volume permissions are root:root.

🛠 Changes

  1. Security Context Enforcement:

    • Configured PodSecurityContext to run as non-root user 10001 (RustFS default).
    • Set fsGroup: 10001 and fsGroupChangePolicy: "OnRootMismatch" to ensure Kubernetes recursively changes ownership of mounted PVCs to the RustFS user.
  2. Log Volume Management:

    • Added an EmptyDir volume mounted at /logs.
    • This prevents RustFS from trying to write logs to the container's root filesystem (which might be read-only) or a host path with incorrect permissions.

🧪 Testing

  • Unit Tests: Added test_statefulset_sets_security_context_and_log_volume to verify that### 🐛 Bug Fix

This PR addresses the "Permission denied" issue reported in #987 when bootstrapping clusters on storage backends like Longhorn or local paths where default volume permissions are root:root.

🛠 Changes

  1. Security Context Enforcement:

    • Configured PodSecurityContext to run as non-root user 10001 (RustFS default).
    • Set fsGroup: 10001 and fsGroupChangePolicy: "OnRootMismatch" to ensure Kubernetes recursively changes ownership of mounted PVCs to the RustFS user.
  2. Log Volume Management:

    • Added an EmptyDir volume mounted at /logs.
    • This prevents RustFS from trying to write logs to the container's root filesystem (which might be read-only) or a host path with incorrect permissions.

🧪 Testing

  • Unit Tests: Added test_statefulset_sets_security_context_and_log_volume to verify that

Summary:
- Enforce non-root execution (UID/GID/fsGroup 10001) with fsGroupChangePolicy to make PVC mounts writable.
- Add EmptyDir-backed /logs mount to avoid host filesystem permission issues.
- Keep env merging behavior unchanged; credentials via Secret still honored.

This fixes the 'Permission denied' error seen when bootstrapping clusters on certain storage backends (e.g. Longhorn) where the default docker volume permissions are root:root.
@loverustfs loverustfs added this pull request to the merge queue Dec 22, 2025
Merged via the queue into main with commit 6ef089a Dec 22, 2025
2 checks passed
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

Successfully merging this pull request may close these issues.

4 participants