Run builds on a dedicated node
Reserve one node of a cluster for builds, so a repository's Dockerfile never runs on the nodes that host your services, the agent or its access broker.
A build runs the commands in a repository's Dockerfile. The build job is confined, but it still runs on a node's kernel. On a cluster with more than one node, reserve a node for builds so that code never shares a kernel with your workloads or with the agent.
Before you begin
- The cluster has at least two nodes. On a single-node cluster, builds and services share the node, and nothing here applies.
- The node you reserve has enough free disk for builds. A build can use about 25 GiB of scratch space at the default limits. See Change build limits.
- You have shell access as root to a server node of the cluster.
How placement works
Without a dedicated node, a build runs on any node. The agent and its access broker prefer other nodes than the one running a build, but run beside it when the cluster has no other node.
When any node carries the label nebula.dev/build-node=true, every build that starts afterwards runs only on labelled nodes, and tolerates the taint nebula.dev/build-node=true:NoSchedule. A build never falls back to another node. If every labelled node is down or full, the build waits until its 30-minute limit and fails.
A build that is already running keeps its node.
Steps
Label the node. NODE is the name in k3s kubectl get nodes.
k3s kubectl label node NODE nebula.dev/build-node=trueTaint the node, so that services and system pods are not scheduled on it.
k3s kubectl taint node NODE nebula.dev/build-node=true:NoScheduleStart a build from the service's Deployments tab.
Verify
Start a build, then list the node of its pod:
k3s kubectl -n nebula-build get pods -o wideNAME READY STATUS RESTARTS AGE IP NODE
build-1f3c9a2e-x7k2p 3/4 Running 0 41s 10.42.2.17 builder-1The NODE column shows the labelled node.
Undo it
Remove the taint and the label. Builds then run on any node again.
k3s kubectl taint node NODE nebula.dev/build-node=true:NoSchedule-k3s kubectl label node NODE nebula.dev/build-node-Next steps
Update a cluster agent
Update the agent that runs in a cluster from the console, roll it back, and re-apply the install manifest when an older cluster needs new permissions.
Change build limits
Raise or lower the CPU, memory and scratch disk one build may use on a cluster, and the quota that caps all builds together.