PID 1 or under an init
axed is designed to be the container’s first process, and needs no init such as tini.- As PID 1, axed reaps every orphan in the PID namespace, and can take over the container’s cgroup.
- Under another init or on a host, axed registers itself as a child subreaper, so orphaned grandchildren of the processes it starts still come back to it. Whoever is PID 1 reaps orphans from elsewhere.
axectl info shows which applies:
--shutdown-timeout (default 10s). As PID 1, its exit also makes the kernel kill whatever is left in the PID namespace.
SIGTERM and SIGINT shut axed down. To keep running on SIGTERM, for platforms that suspend instead of stopping, use --on-sigterm=stay. See Agent Substrate.
Cgroups
With a writable, delegated cgroup v2 subtree, axed gives every process its own cgroup. That gives:- a kill that reaches every descendant (
cgroup.kill), - memory, CPU and task limits for the whole process tree,
- OOM detection, reported as the
oom-killedstate, - freezing every process before a snapshot (
axectl freeze).
/proc, maps memory limits to RLIMIT_AS (per process) and task limits to RLIMIT_NPROC (which counts every process of the user), and refuses CPU limits and freezing.
auto uses cgroups when axed owns a writable cgroup v2 subtree and logs cgroups unavailable; using process groups and rlimits otherwise. off never uses them. required refuses to start without them.What delegation means
axed takes over the cgroup it runs in. It moves itself into anaxed child cgroup, enables the cpu, memory and pids controllers that are available, and creates one child cgroup per process. For that it needs:
- cgroup v2 mounted in unified mode at
/sys/fs/cgroup, - write access to its own cgroup directory, which usually means running as root or as the user the cgroup was delegated to,
- its cgroup to itself. axed refuses to take over a cgroup shared with other processes unless it is PID 1, because moving them would surprise their owner.
/sys/fs/cgroup read-only, so cgroups are unavailable. In Kubernetes, the container needs a writable, delegated cgroup v2 mount. Under an init such as docker run --init, the init shares axed’s cgroup, so axed does not take it.
Try cgroups locally
For local testing, give the container a private cgroup namespace and a writable cgroup mount. The default image runs as user 1000, which cannot write the cgroup tree, so run as root:Running as non-root
The default image runs as user 1000. Agent Sandbox pods run it withrunAsNonRoot, all capabilities dropped and no privilege escalation. axed runs as non-root without capabilities, with these limits:
- Processes run as axed’s user. Starting a process as another user (
axectl run --user) needs the privilege to switch users. - cgroups are usually unavailable unless the cgroup was delegated to that user.
axectl resumed(System.Configure) steps the wall clock if it is more than 50 ms off, which needsCAP_SYS_TIME, then adds entropy if axed hasCAP_SYS_ADMIN(skipped otherwise, and reported asentropy not added), then records the resume. WithoutCAP_SYS_TIMEit fails whenever the clock is off by more than 50 ms, and then records no resume.
Resource limits
Each process can carry its own limits, set by the client when it starts the process. Withaxectl:
Set daemon-wide limits on axed’s command line:
axed caps client connections at half the hard descriptor limit (
ulimit -Hn), clamped between 16 and 65,536, and splits the cap evenly among the listeners and the REST port. See the axed reference for every flag.
Set the container’s own CPU and memory limits too. They bound axed and everything it runs together.
