SELinux configurations for Private OpenShift deployments

OpenShift is the de facto Kubernetes manager that gets deployed in a private cloud. Because of its ease of use and setup, it is often the go to choice for organizations running in a private cloud. AIStor supports OpenShift in all facets from install, to configurations to updates and everything in between. Here we will show you how to configure SELinux
Overview
SELinux will try to tag all files in the filesystem, causing the pod start to be delayed until all files are tagged, often when the PVC has a bigger amount of fies this will cause a timeout and the minio container will not even start.
Example tag with SecurityContextConstraint
(SCC) restricted:
system_u:object_r:container_file_t:s0:c19,c27
Current Behavior
- AIStor pod can't start, hanging with
CreateContainerError
- In pod events shows an Error: context deadline exceeded event
- Logging into the host machine, an event (
journalctl -u crio -f
) can be read as follows:
Creation of container k8s_minio_production-pool-1-3_production_1678f3c3-db33-4d76-87e9-e549451d5853_1
is not yet finished. Currently at stage container volume configuration.
Possible solutions
Some options to overcome this problem are presented
Skip SELinux Relabeling if already done with an annotation
This is my favourite, safer and the right way (IMHO) even if more "complex" , this consists of 3 steps :
- Create a custom runtime
Manual Skip SELinux Relabeling with spc_t
This effectively elevates privileges of the pods (unsafe), to apply this option:
- Create an Openshift SecurityContextConsraint (scc) that allows spc_t,
- Add the new scc to the pod
Semi - Automatic Skip SELinux Relabeling with spc_t (OCP Version 4.13+)
If you would like to setup using a semi-automated setup, more information is documented in this RedHat Knowledge base.
Conclusion
SELinux security is usually set up in large organizations to be PCI/SOC compliant. It's essential for all applications to work with SELinux enabled. In this overview we’ve showed you the different ways AIStor can be configured with OpenShift to be as secure as possible on a Linux machine.
Feel free to try this out yourself and if there are any questions be sure to reach out to us at hello@min.io.