sandboxd-o

Base URL: http://localhost:8080

Health

Response

{
    "ok": true
}

Node Status (Unified Heartbeat + Resources)

Response

{
    "ok": true,
    "resources": {
        "capacity_cpu_milli": 8000,
        "capacity_memory_bytes": 33554432000,
        "allocatable_cpu_milli": 7200,
        "allocatable_memory_bytes": 30198988800,
        "used_cpu_milli": 500,
        "used_memory_bytes": 536870912,
        "available_cpu_milli": 6700,
        "available_memory_bytes": 29662117888,
        "max_alloc_percent": 90,
        "updated_at": "2026-05-14T01:00:00Z"
    }
}

Sandbox APIs

Create Sandbox

Request

{
    "id": "sbx-http-demo",
    "egress": true,
    "ports": [
        {
            "hostPort": 30080,
            "containerPort": 8080,
            "protocol": "tcp"
        }
    ],
    "readinessProbe": {
        "protocol": "http",
        "port": 8080,
        "path": "/healthz",
        "initialDelaySeconds": 1,
        "periodSeconds": 1,
        "timeoutSeconds": 1,
        "successThreshold": 2,
        "failureThreshold": 3
    },
    "containers": [
        {
            "name": "web",
            "image": "python:3.12-alpine",
            "args": [
                "sh",
                "-c",
                "mkdir -p /tmp/www && echo sandbox-http > /tmp/www/index.html && cd /tmp/www && python -m http.server 8080"
            ],
            "env": [],
            "workDir": "",
            "resource": {
                "cpu": "250m",
                "memory": "256Mi",
                "ephemeralStorage": "96Mi"
            }
        },
        {
            "name": "worker",
            "image": "alpine:3.20",
            "args": ["sh", "-c", "while true; do sleep 60; done"],
            "env": [],
            "workDir": "",
            "resource": {
                "cpu": "100m",
                "memory": "128Mi",
                "ephemeralStorage": "96Mi"
            }
        }
    ]
}

Response (Accepted)

{
    "sandbox": {
        "id": "sbx-http-demo",
        "phase": "creating",
        "namespace": "k8s.io",
        "ip": "",
        "subnetCIDR": "10.89.0.0/16",
        "bridgeName": "sbx-br0",
        "egress": true,
        "ports": [
            {
                "hostPort": 30080,
                "containerPort": 8080,
                "protocol": "tcp"
            }
        ],
        "containers": {
            "web": {
                "id": "sbx-http-demo-web",
                "name": "web",
                "phase": "creating",
                "image": "python:3.12-alpine",
                "args": [
                    "sh",
                    "-c",
                    "mkdir -p /tmp/www && echo sandbox-http > /tmp/www/index.html && cd /tmp/www && python -m http.server 8080"
                ],
                "resource": {
                    "cpu": "250m",
                    "memory": "256Mi"
                },
                "taskPID": 0,
                "runtime": "runsc"
            },
            "worker": {
                "id": "sbx-http-demo-worker",
                "name": "worker",
                "phase": "creating",
                "image": "alpine:3.20",
                "args": ["sh", "-c", "while true; do sleep 60; done"],
                "resource": {
                    "cpu": "100m",
                    "memory": "128Mi"
                },
                "taskPID": 0,
                "runtime": "runsc"
            }
        },
        "cniConfPath": "/etc/cni/sandboxd.d/20-sbxnet.conflist",
        "createdAt": "2026-05-08T11:00:00Z",
        "updatedAt": "2026-05-08T11:00:00Z"
    }
}

Error Examples

{
    "error": "container web: cpu is required"
}
{
    "error": "insufficient cpu allocatable: requested=2000m used=7000m limit=7200m (90% of host)"
}
{
    "error": "insufficient memory allocatable: requested=17179869184 used=34359738368 limit=42949672960 (90% of host)"
}
{
    "error": "insufficient ip addresses in subnet 10.89.0.0/16: in_use=65534 usable=65534"
}
{
    "error": "host port already in use: 30080/tcp (sandbox sbx-old)"
}

List Sandboxes (Cursor Pagination)

Response

{
    "items": [
        {
            "id": "sbx-http-demo",
            "phase": "running",
            "namespace": "k8s.io",
            "ip": "10.89.0.18",
            "subnetCIDR": "10.89.0.0/16",
            "bridgeName": "sbx-br0",
            "egress": true,
            "ports": [
                {
                    "hostPort": 30080,
                    "containerPort": 8080,
                    "protocol": "tcp"
                }
            ],
            "containers": {
                "web": {
                    "id": "sbx-http-demo-web",
                    "name": "web",
                    "phase": "running",
                    "image": "docker.io/library/python:3.12-alpine",
                    "resource": {
                        "cpu": "250m",
                        "memory": "256Mi"
                    },
                    "taskPID": 12345,
                    "runtime": "runsc",
                    "taskStatus": "running"
                }
            },
            "cniConfPath": "/etc/cni/sandboxd.d/20-sbxnet.conflist",
            "createdAt": "2026-05-08T11:00:00Z",
            "updatedAt": "2026-05-08T11:00:12Z"
        }
    ],
    "next_cursor": "sbx-http-demo"
}

Get Sandbox

Response

{
    "sandbox": {
        "id": "sbx-http-demo",
        "phase": "running",
        "namespace": "k8s.io",
        "ip": "10.89.0.18",
        "subnetCIDR": "10.89.0.0/16",
        "bridgeName": "sbx-br0",
        "egress": true,
        "ports": [
            {
                "hostPort": 30080,
                "containerPort": 8080,
                "protocol": "tcp"
            }
        ],
        "containers": {
            "web": {
                "id": "sbx-http-demo-web",
                "name": "web",
                "phase": "running",
                "image": "docker.io/library/python:3.12-alpine",
                "args": [
                    "sh",
                    "-c",
                    "mkdir -p /tmp/www && echo sandbox-http > /tmp/www/index.html && cd /tmp/www && python -m http.server 8080"
                ],
                "resource": {
                    "cpu": "250m",
                    "memory": "256Mi"
                },
                "taskPID": 12345,
                "runtime": "runsc",
                "taskStatus": "running"
            },
            "worker": {
                "id": "sbx-http-demo-worker",
                "name": "worker",
                "phase": "running",
                "image": "docker.io/library/alpine:3.20",
                "args": ["sh", "-c", "while true; do sleep 60; done"],
                "resource": {
                    "cpu": "100m",
                    "memory": "128Mi"
                },
                "taskPID": 12346,
                "runtime": "runsc",
                "taskStatus": "running"
            }
        },
        "cniConfPath": "/etc/cni/sandboxd.d/20-sbxnet.conflist",
        "createdAt": "2026-05-08T11:00:00Z",
        "updatedAt": "2026-05-08T11:00:12Z"
    }
}

Batch Sandbox Status

Request

{
    "ids": ["sbx-a", "sbx-b"]
}

Response

{
    "items": [
        {
            "id": "sbx-a",
            "phase": "running",
            "error": "",
            "unhealthy_containers": []
        },
        {
            "id": "sbx-b",
            "phase": "error",
            "error": "pull image \"docker.io/library/nginx:bad\": ...",
            "unhealthy_containers": [
                {
                    "name": "web",
                    "phase": "error",
                    "error": "container not found",
                    "task_status": "not_found"
                }
            ]
        }
    ],
    "missing": ["sbx-missing"]
}

Sandbox Logs

Note:

Response

{
    "sandbox_id": "sbx-http-demo",
    "logs": {
        "lines": [
            "[app] Serving HTTP on 0.0.0.0 port 8080 (http://0.0.0.0:8080/) ...",
            "[db] database system is ready to accept connections"
        ]
    }
}

Delete Sandbox

Response

{
    "id": "sbx-http-demo",
    "phase": "deleted"
}

Manual Reconcile

Response

{
    "ok": true
}

Resource Field Format

containers[].resource.cpu

containers[].resource.memory

containers[].resource.ephemeralStorage (optional)

Common Error Response

{
    "error": "error message"
}

Logging Configuration

Example Create Payload (Wordpress)

{
    "id": "sbx-wordpress-demo",
    "egress": true,
    "ports": [
        {
            "hostPort": 30080,
            "containerPort": 80,
            "protocol": "tcp"
        }
    ],
    "containers": [
        {
            "name": "wordpress",
            "image": "wordpress:6.9.4-php8.3-apache",
            "args": [
                "sh",
                "-c",
                "for i in $(seq 1 90); do php -r '$s=@fsockopen(\"127.0.0.1\",3306,$e,$es,1); if($s){fclose($s); exit(0);} exit(1);' && break; sleep 2; done; exec docker-entrypoint.sh apache2-foreground"
            ],
            "env": [
                "WORDPRESS_DB_HOST=127.0.0.1:3306",
                "WORDPRESS_DB_USER=wordpress",
                "WORDPRESS_DB_PASSWORD=wordpress-pass",
                "WORDPRESS_DB_NAME=wordpress"
            ],
            "workDir": "",
            "resource": {
                "cpu": "200m",
                "memory": "512Mi"
            }
        },
        {
            "name": "mysql",
            "image": "mysql:8.4",
            "args": [],
            "env": [
                "MYSQL_DATABASE=wordpress",
                "MYSQL_USER=wordpress",
                "MYSQL_PASSWORD=wordpress-pass",
                "MYSQL_ROOT_PASSWORD=root-pass"
            ],
            "workDir": "",
            "resource": {
                "cpu": "200m",
                "memory": "768Mi"
            }
        }
    ]
}