Enable Docker-in-Docker
To run Docker inside SUNK compute nodes, you must disable AppArmor and run privileged Pods. The following changes to the Slurm Helm chart install the Docker daemon on each compute node, mount storage for Docker that lasts for the lifetime of the Pod, and relax the security context so the daemon can operate. To disable AppArmor and run privileged Pods, edit thevalues.yaml file of the Slurm Helm chart.
In the compute section of the slurm Helm chart:
-
Create an
s6block to install and enable Docker. Because the Docker service is alongrun, settimeoutUp,timeoutDown, or both. SUNK rejects alongrunservice that sets neither. See Set timeouts for scripts. -
Add a volume mount for Docker using the
volumeMountsandvolumesblocks. -
Under
pyxis, apply the following settings:- Set
pyxis.enabledtotrue. - Set
pyxis.appArmorProfiletounconfinedto disable AppArmor confinement. - Set
pyxis.podSecurityContext.seccompProfile.typetoUnconfinedto disable seccomp filtering.
unconfinedsettings. In SUNK v8, the operator restores the default profiles when these values are omitted or set tonull. - Set
-
Under
securityContext, setsecurityContext.privilegedtotruefor theslurmdcontainer. The result should resemble the following: -
Apply the values through your Helm deployment and wait for the compute Pods to roll out. For CPU-only testing, also set
compute.gpusd.enabledtofalseto prevent the GPUSD installer from competing with Docker for the package-manager lock. -
Verify the running Pod’s security settings. This check requires
jq. Replace[SLURMD-POD-NAME]with the name of your slurmd Pod and[NAMESPACE]with its namespace.Verify thatprivilegedistrue,appArmorAnnotationisunconfined, andpodSeccomp.typeisUnconfined. If the container has anappArmorfield, itstypemust also beUnconfined. -
After Docker finishes installing, verify that it can run a container:
The output should include
Hello from Docker!.
Grant users Docker access
With the Helm chart changes applied, Docker is available on the compute nodes, but onlyroot can use it by default. The next step grants non-root users the permissions they need to run Docker commands.
After you disable AppArmor and enable privileged Pods, grant users access to Docker.
If not running as root, users must belong to the sudoers group. If the SUNK cluster manages users with SUNK User Provisioning (SUP), set nsscache.sudoGroups to the groups that should have sudo privileges.
SUP-based clusters
For SUP-based clusters, configurensscache: to provision access through SCIM, and list the sudo-enabled groups under sudoGroups:. Group names must exactly match the group names in CoreWeave IAM or your upstream IdP. Refer to the SUP documentation on creating user groups.
SSSD-based clusters
For SSSD-based clusters, set thesudoGroups: configuration in directoryService: to a list of Unix groups from all directories with sudo privileges.
- The group names are not fully qualified for the default directory. For example, the default directory’s group name should be
group1instead ofgroup1@example.com. - The group names are fully qualified for any additional directories.
Known security risks
Enabling Docker-in-Docker requires loosening several of SUNK’s default isolation guarantees. Before you apply the preceding configuration, review the risks in this section so you can decide whether the trade-offs are acceptable for your environment. Kubernetes provides a list of pod security standards. The following sections outline the subset most relevant to SUNK, but consider all of the standards listed in the Kubernetes documentation when assessing risk. The setup described in this guide:- Runs Docker inside a Pod.
- Requires privileged mode.
- Disables AppArmor protections.
This setup grants full access to the
/proc and sys directories, and allows kernel-level operations, including mounting, pivoting root, and process tracing.Item at risk: cgroups
cgroups handle management and monitoring of resources used by Slurm jobs. In privileged mode, users can bypass cgroup restrictions, reconfigure the resource limits set by Slurm, and move processes outside of their assigned cgroups. This is critical to understand when providing support for multi-tenancy in a single CKS cluster. The same guardrails you depend on for isolation do not apply here.
Item at risk: System and security
Disabling AppArmor on a privileged Pod removes additional security features, including protections against kernel exploits. This allows unrestricted access to the/proc and /sys directories. Without AppArmor protections in place, users can gain access to and tamper with other containers in the Pod, or access other devices outside the intended allocation.