Skip to content

fix(examples): diagnose incompatible EKS sandbox settings - #384

Merged
kevin-orellana merged 6 commits into
mainfrom
feature/eks-cluster-preflight
Nov 11, 2026
Merged

kevin-orellana merged 6 commits into
mainfrom
feature/eks-cluster-preflight

Conversation

@kevin-orellana

@kevin-orellana kevin-orellana commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Human readable section

Problem: An EKS cluster can accept the example Job while removing settings Box needs, leaving users with an unexplained /proc mount failure.

Solution: Check the settings returned by a server dry run before creating the Job, then verify the created Job and Pods. Add feature-gate hints and optional worker diagnostics. Document the tested cluster baseline and older-cluster limits. Put required setup and expected results before optional diagnostics and troubleshooting.

Trade-off: This diagnoses configuration changes; it does not enable cluster features or prove worker compatibility. Pods can start before the later inspection. Created Jobs remain available for inspection and cleanup.

The deployment client sends a server dry run to the Kubernetes API on Amazon EKS. It compares returned sandbox settings. Missing or changed settings produce an error without creating a Job; preserved settings permit Job creation and actual Pod inspection.

The preflight reports missing settings before creating a Job. Editable diagram

Description

The EKS example checks hostUsers: false, procMount: Unmasked, and the effective seccompProfile.type: Unconfined. A late failure retains the receipt, submitted Job, observed Pod configuration, and recovery command. Before it first observes a Pod, the script reads the Job’s FailedCreate events and reports the controller’s message. Creation events and event-query errors remain warnings so the controller can retry. If the Job fails before creating a Pod or the wait expires, the receipt includes the last creation error. Configuration errors name the relevant feature gates as troubleshooting hints. After saving the workload receipt, an optional lookup records each assigned worker’s kubelet, kernel, container runtime, and architecture. Its separate ten-second budget cannot consume the Job monitoring deadline, and lookup failures do not change the workload result. Box Core and its sandbox configuration are unchanged.

Related Issues

Addresses https://github.com/strands-agents/staging-boxy/issues/351.

Type of Change

Bug fix; documentation update.

Validation and contributor checklist

Testing

  • At 2f6b9c9, 39 deployment-script tests pass, including API errors/timeouts, altered settings, inherited seccomp, receipts, offline rendering, admission rejections, dry-run warnings, later Pod success after quota, webhook, admission, or event-access errors; and nonfatal worker lookups, malformed responses, multiple nodes, and monitoring-deadline isolation.

  • Disabling the settings guard makes all three targeted regression cases fail. Restoring immediate failure on creation events breaks all three recovery cases; removing the final creation error breaks the deadline-receipt check. Reusing historical events after a Pod disappears breaks the stale-event regression. Moving worker lookups back into monitoring breaks the advancing-clock regression.

  • At 233174d, all 27 site-manifest tests pass. The tutorial also passes shell syntax and local-link checks; incoming anchors remain valid. Independent readability review found no material issues. Earlier, the hosted site-manifest check and cloud-example checks passed at 2f6b9c9.

  • CARGO_PROFILE_DEV_DEBUG=0 CARGO_PROFILE_TEST_DEBUG=0 CARGO_INCREMENTAL=0 cargo test --workspace --all-features: failed in the unchanged core library (795 passed, 69 failed). 66 failure sections contain invalid mount table for trusted executable aliases; the workspace run stops at this target. This is not a full-suite pass. Debug symbols were disabled after the first build exhausted available disk headroom.

  • Independent code and documentation reviews: no blocking findings. The automated review of 2f6b9c9 reported no correctness findings and confirmed 39 passing tests.

  • Live EKS 1.31.14: the API removed hostUsers and returned procMount: Default. Both the published 69b3cb7 script and 2f6b9c9 exited before Job creation; zero Jobs remained.

  • Live EKS 1.33.13, Amazon Linux 2023 ARM64, kernel 6.12.113, containerd 2.3.7: both scripts passed all 11 checks. The updated script also recovered after an admission rejection was removed. A persistent admission rejection produced a failed receipt containing the controller’s Pod Security message; no Pod was created. These are tested configurations, not a minimum-version guarantee.

  • Live workloads used the sample’s pinned Box core (f0dc6f4) and matching test script. Existing verified image layers were reused with the missing revision metadata added; this was not a fresh full image build.

  • Diagram: pinned draw.io container, scale 2, border 20; zero layout errors and PNG visually inspected. New figure, so no prior-image control comparison applies.

  • I ran the relevant suites (just check, or cargo test --workspace --all-features)

  • If I touched Rust, I ran cargo fmt --all and cargo clippy --workspace --all-targets --all-features -- -D warnings — not applicable; no Rust changed.

Checklist

  • I have read the CONTRIBUTING document
  • I have reviewed and understand every line of code in this PR, including any generated by AI tools, and I can explain why it works
  • My change is focused and reasonably small; I have split unrelated work into separate PRs
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • My changes generate no new warnings

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

## Problem

EKS can accept a Job while discarding the sandbox settings Box requires.
The example then exposes a proc mount error instead of the configuration gap.
The guide lists tested versions without explaining older-cluster behavior.

## Solution

Check the server dry-run response before creating a Job, then validate the
created Job and actual Pods. Keep receipts and recovery details after creation.
Document the tested baseline, separate feature gates, and worker/admission limits.
No Box Core interfaces or containment grants change.

## Tests

All 22 Python deployment tests pass. The dry-run, created-Job, and actual-Pod
regressions each fail when the guard is disabled. All 27 site-manifest tests pass.
Independent code and documentation reviews found no blocking change defects.
The workspace suite ran with debug symbols disabled: the unchanged core library
had 795 passes and 69 failures, predominantly invalid host mount-table errors.
The full workspace suite is not green. No live EKS or older-cluster opt-in test ran.
Comment thread examples/cloud-deployments/eks/run.py Resolved
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

Assessment: Comment

At head e220ce2, the dry run correctly catches settings that the API server drops, and the Job and Pod re-checks catch settings changed later. One gap remains: Pod-level admission that rejects the Pod outright (PSA enforce, validating webhooks) leaves no Pods to inspect. That run still ends in a generic failure after activeDeadlineSeconds (see inline comment).

Assumptions and rules checked that held
  • An API-server gate (UserNamespacesSupport, ProcMountType) that drops or replaces a field in the Job template is caught by the dry run before any Job is created.
  • A dry-run API error or timeout creates no Job and writes no evidence.
  • Pod-level seccompProfile is inherited, and a container-level override takes precedence.
  • A setting changed only on the created Job or the actual Pod gives a failed receipt, keeps the evidence, and prints the recovery command.
  • A succeeded Job with no observable Pod is refused.
  • --render output and the validation behaviour that existed before are unchanged. Root AGENTS.md says "Committed examples must still work", and this holds.
  • No frozen surface (CLI, box.toml, records, docs/site-manifest.json) and no foundational premise is touched. No Rust changed. There is no AGENTS.md under examples/.
  • python3 -m unittest test_run: 22 tests pass at the head commit.

The table that maps each required setting to its reason gives users the right next step.

Comment thread examples/cloud-deployments/eks/run.py Resolved
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

Assessment: Comment

ad5fa82 fixes the earlier gap: a Pod that admission rejects is now reported from the Job's FailedCreate events, and dry-run warnings are printed. The new branch also treats retryable creation errors (quota, webhook timeout) as final, which fails runs that passed before (see the inline comment on line 169).

Assumptions and rules checked that held
  • A PSA enforce denial or a webhook denied the request stops right away with the controller's message, a failed receipt, and the recovery command.
  • The event query is scoped by Job UID (involvedObject.uid), so events from an earlier Job with the same name cannot match.
  • A denied or timed-out event query only gives a warning, and the bounded wait continues.
  • Earlier checks (dry-run drop, Job and Pod re-checks, seccomp inheritance, succeeded with no Pod) are unchanged.
  • No frozen surface or premise from AGENTS.md is touched. The tutorial now documents the events permission.
  • python3 -m unittest test_run: 26 tests pass at ad5fa82.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

Assessment: Comment

6934f69 resolves the previous finding: transient FailedCreate errors are now warnings, and a later valid Pod is accepted. One non-blocking edge case remains: if a Pod disappears after an earlier creation error, the receipt blames the creation error (see the inline comment on line 150).

Assumptions and rules checked that held
  • A quota or webhook-timeout event followed by a successful retry gives passed: true, the same as on e220ce2.
  • A persistent PSA denial gives a failed receipt with the admission message once activeDeadlineSeconds (300 s) expires. This is inside the 360 s script wait, so the Job's failure, not the script deadline, ends the run.
  • A deadline expiry while a creation error is saved adds Last Pod creation error to the receipt.
  • Earlier checks (dry-run drop, Job and Pod re-checks, events-RBAC warning, Job-UID event scope) are unchanged.
  • No frozen surface or premise from AGENTS.md is touched. The tutorial now matches the warning-and-retry behaviour.
  • python3 -m unittest test_run: 28 tests pass at 6934f69.

Comment thread examples/cloud-deployments/eks/run.py Resolved
@github-actions

Copy link
Copy Markdown

Assessment: Approve

69b3cb7 adds a pod_seen flag. After a Pod has been observed, the events query and the "failed before a Pod was created" branch no longer run, which resolves the last open finding. I found no new correctness issues.

Assumptions and rules checked that held
  • Creation error, then Pod, then Pod evicted and Job Failed: no stale creation error is reported, and no duplicate warning is printed.
  • A transient quota or webhook FailedCreate followed by a Pod on retry gives passed: true.
  • A persistent PSA denial gives a failed receipt that includes the admission message.
  • Every observed Pod still gets require_sandbox_settings. The dry-run, created-Job, events-RBAC, and Job-UID scope checks are unchanged.
  • The tutorial wording ("Before it first observes a Pod") matches the code. No frozen surface or premise from AGENTS.md is touched.
  • python3 -m unittest test_run: 29 tests pass at 69b3cb7.

Each case found during review now has a regression test.

@github-actions

Copy link
Copy Markdown

Assessment: Approve

2f6b9c9 does three things: it records versions for the nodes the Job's Pods were assigned to, adds troubleshooting hints to the settings-mismatch errors, and replaces the tested baseline with EKS 1.33.13 (scripted) and 1.35 (Claude). I found no correctness issues. The node lookups never change the workload result, and they run after the receipt is saved.

Assumptions and rules checked that held
  • Node lookup succeeds: kubelet, kernel, runtime, and architecture are printed and saved to node-diagnostics.json; rc 0.
  • Namespace-scoped RBAC (get node Forbidden): one warning, and the receipt still says passed: true with rc 0, as the tutorial says.
  • Node lookup hangs: call turns TimeoutExpired into exit code 124 within the 10 s budget, so the run still passes. Malformed nodeInfo (list, missing key, bad JSON) is caught.
  • Pod stuck on a node until the script deadline: the node is still recorded, after the failed receipt and the recovery command.
  • A Pod first seen unscheduled with no nodeName: later polls pick up the node, and nodes are recorded before the settings check.
  • The tutorial's example error text matches the new require_sandbox_settings output. The hints are labelled as unconfirmed.
  • The README's 1.31.14 dry-run mismatch and 1.33.13 pass are consistent with UserNamespacesSupport and ProcMountType turning on by default in 1.33.
  • The earlier FailedCreate and pod_seen logic is unchanged. No frozen surface or premise from AGENTS.md is touched.
  • python3 -m unittest test_run: 39 tests pass at 2f6b9c9.

Comment thread docs/user/tutorials/eks.md Resolved
opieter-aws
opieter-aws previously approved these changes Nov 11, 2026
@github-actions

Copy link
Copy Markdown

Assessment: Approve

233174d only restructures docs/user/tutorials/eks.md. It adds a settings table to "Check your cluster" and moves the failure guidance into a "Troubleshoot startup" section. I found no prose that disagrees with run.py or the README. Whether the page is now easy enough to read is for @opieter-aws's open thread.

Assumptions and rules checked that held
  • The incoming anchors still resolve: #cluster-baseline (from the run.py error text and the sample README, now an explicit <a id>), #run-claude-code (from claude/README.md), and the outgoing claude/README.md#check-cooldown-expiry-without-a-model. The internal #troubleshoot-startup and #clean-up links resolve.
  • The example dry-run error matches the require_sandbox_settings output at this head. The FailedCreate, pod_seen, and node-diagnostic descriptions (get node rather than list, separate 10 s budget, no change to the result, runs after the receipt and recovery command) match the code I reviewed at 2f6b9c9. run.py is unchanged since then.
  • No requirement was dropped. The hostUsers, procMount, and seccompProfile requirements and the user-991 hardening moved from "Before you start" into the new table. The note that create-Job permission is needed for the server dry run, and the namespace-scoped events-permission note, are both still present.
  • The feature-gate statements (separate gates in 1.31, on by default upstream from 1.33, a kubelet-only gate change does not enable the API-server feature) agree with the README's 1.31.14 and 1.33.13 results.
  • Root AGENTS.md (publishable page under docs/user/): cargo test -p strands-box --test site_manifest --locked --all-features gives 27 passed. The manifest's tutorial-eks entry and its slug are unchanged.

@kevin-orellana
kevin-orellana merged commit f74adb1 into main Nov 11, 2026
23 of 24 checks passed
@kevin-orellana
kevin-orellana deleted the feature/eks-cluster-preflight branch November 11, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants