Sub topic 10
Choosing a container mode
This chapter assumes you have already deployed a runner scale set with Helm, as in the previous chapters. You should know what a pod, a sidecar container, and a PersistentVolumeClaim are.
What a container mode decides
Many workflows need containers while they run. They build images with docker build, start service containers such as a database, or use a container: job. A runner pod has to provide that capability somehow. The containerMode setting in the scale set values chooses how. ARC supports two modes: dind and kubernetes.
dind: Docker-in-Docker
In dind mode, each runner pod gets a Docker daemon beside the runner container. The two share a volume and a socket. Workflow steps call docker as they would on a normal Linux VM.
containerMode:
type: "dind"This is the same setting you used in the earlier values file. The mode has these properties:
- Existing workflows that use
docker build,docker run, ordocker composework without changes. - Container jobs, service containers, and container actions work.
- The Docker daemon container runs privileged. A job that escapes the container can reach the node.
- No storage setup is needed. The pod uses an
emptyDirvolume. - Each pod runs its own daemon, so every job starts with a cold image cache.
kubernetes: runner container hooks
In kubernetes mode, there is no Docker daemon. The runner uses container hooks to create a separate pod for each job or container step. The runner pod coordinates, and the workflow pod does the work. Both mount a shared work volume.
containerMode:
type: "kubernetes"
kubernetesModeWorkVolumeClaim:
accessModes: ["ReadWriteOnce"]
storageClassName: "standard"
resources:
requests:
storage: 1GiThe chart also creates a Role that lets the runner create and delete pods in its namespace. This mode has these properties:
- No privileged container is required, which makes it easier to meet restrictive pod security policies.
- Pods created for jobs are normal Kubernetes pods. You can schedule, limit, and observe them with the usual tools.
- The cluster needs a storage class that can provision volumes dynamically. Each runner gets its own claim.
- Plain
dockercommands do not work, because there is no daemon. Steps that build images need a daemonless builder such as Kaniko or BuildKit, or a different runner pool. - Container jobs must use an image that includes the tools the runner needs. Pod startup adds some latency.
Comparing the modes
| Concern | dind | kubernetes |
|---|---|---|
| `docker` CLI in steps | Works | Not available |
| Privileged container | Yes | No |
| Storage setup | None | Dynamic volumes |
| Job isolation | Inside the runner pod | Separate workflow pod |
| Existing workflow compatibility | High | Needs review |
Common errors
docker: command not foundor "Cannot connect to the Docker daemon". The scale set is inkubernetesmode and the workflow expects Docker. Switch todind, or rewrite the build step.- Runner pod stuck in
Pendingin kubernetes mode. The PersistentVolumeClaim cannot bind. Check thatstorageClassNameexists and can provision volumes. - Pod creation is forbidden in dind mode. The cluster admission policy rejects privileged containers. Use
kubernetesmode or relax the policy for the runner namespace only.
Making the choice
If your workflows build images and you trust the code that runs on them, start with dind. If your cluster policy forbids privileged containers, or you want jobs to be ordinary pods, use kubernetes mode and plan for storage and builds. You can run both: install two scale sets with different installation names and let each workflow choose through runs-on.
Exercise
A team's cluster rejects privileged containers. Their workflows currently run docker build in a step. Which container mode fits the cluster policy, and what must they change in the workflows?
Show answer
Use kubernetes mode, because it needs no privileged container. The workflows can no longer call docker build, so they must switch to a daemonless builder such as Kaniko or BuildKit. The cluster also needs a storage class that can provision the work volume claims.