bottlerocket-os / bottlerocket-os/bottlerocket
Mkfs fails even from priviledged containers
- Dominant language
- Rust
- Stars
- 9.7k
- Forks
- 586
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 11
Description
Hi,
we want to run [Ondat](https://ondat.io) using Bottlerocket as we have a customer requirement to support Bottlerocket.
Ondat is a CSI Driver for Kubernetes that among other things implements a storage engine. Ondat orchestrates data, volume attachments, PVC mounts, etc.
The Ondat storage engine runs on a Daemonset in Kubernetes. It mounts the host filesystem on /var/lib/storageos where the data from PVCs will be persisted. That means that Daemonset Pods need to be able to create special device files and create filesystems on top of the devices. We found that even though the Daemonset Pod is running with:
```
securityContext:
allowPrivilegeEscalation: true
capabilities:
add:
- SYS_ADMIN
privileged: true
```
**Ondat cannot mkfs the device files.**
We used the admin container to reproduce the same behaviour that the storage engine attempts and it looks like SELinux is blocking the permissions for it.
```
bash-5.1#
bash-5.1# mkfs.ext4 ./v.00000000-0000-0000-0000-000000001000
mke2fs 1.46.5 (30-Dec-2021)
mkfs.ext4: Permission denied while trying to determine filesystem size
```
The device file cannot be opened, thus the filesystem cannot be created.
```
[root@admin]# dd if=/.bottlerocket/rootfs/var/lib/storageos/volumes/v.00000000-0000-0000-0000-000000001000 of=/dev/null bs=4k count=1
dd: failed to open '/.bottlerocket/rootfs/var/lib/storageos/volumes/v.00000000-0000-0000-0000-000000001000': Permission denied
```
## Context
- Image: bottlerocket-aws-k8s-1.21-x86_64-v1.9.0-159e4ced
- Cluster: bottlerocket on EKS installed with eksctl
## What I expected to happen
I expect to be able to create devices and create filesystems.
We think we have narrowed the issue to SELinux, so it would be great to know if what we need to do is possible using Bottlerocket.
## Misc
We understand that this procedure must be possible as for instance EBS volumes are allowed to be attached to Bottlerocket and formatted.
Could you please help us understand what needs to be done?
Contributor guide
Assessment
This issue has not been assessed yet.