Repository navigation
Conversation
bpmct
added a commit
to coder/coder
that referenced
this pull request
Nov 17, 2026
Adds a "Sandbox agents" guide under Extending templates, and adds startup time tips from the [Improving Coder Workspace Startup Times](https://www.youtube.com/watch?v=-xcVJQWVCxs) livestream to the speed-up templates guide. **Sandbox agents** (`docs/templates/extending-templates/sandbox-agents.md`) is organized around three traits: kernel, network, and secrets isolation, plus fast startup. Each trait has a short methods table with tradeoffs, plus examples and references. - Starts with the coder-labs registry templates (agent-sandbox, Plain Sandbox, OpenShell) that implement all three, and calls out [agent-sandbox](https://agent-sandbox.sigs.k8s.io/). - Explains what the sandbox covers for CLI Agents, Coder Agents, and Agent Relay. - Shows how to define sandbox profiles as immutable parameters with one preset each, and how to control which profile an agent gets. - Kernel: gVisor, Kata, and EKS Nitro Sandboxes (`isolated-sandbox` RuntimeClass in EKS Auto Mode). - Network: separate proxy Pod vs. sidecar, example rules using an internal GitHub and artifact store, and a cloud firewall layer (AWS Network Firewall, Route 53 Resolver DNS Firewall) that also limits DNS. - Secrets: `api_key_scope = "no_user_data"`, a scoped AI Gateway token (skipped for prebuilds, optional `lifetime`), per-workspace EKS Pod Identity, and just-in-time credentials from Vault. **Speed up templates** (`docs/workspaces/speed-up-templates.md`) gets new sections for pre-warming Kubernetes nodes (with GKE, EKS, and AKS alternatives), building tools into the image, prebuilt workspaces (including one preset for each configuration), and skipping the Kubernetes rollout wait (with coder-logstream-kube to surface Pods that can't start). It links the [fast-workspaces-lab](https://github.com/coder-contrib/fast-workspaces-lab) repo for the sample base image, node schedule, and prebuild templates. **Agent Firewall** gets a notice on its index page and in the glossary that it is being phased out, pointing to the sandbox guide. The sandbox guide doesn't mention Agent Firewall. Two diagrams in the speed-up templates guide come from the talk's slide deck, cropped to the diagram. Notes for reviewers: - The scoped AI Gateway token (`user:read_personal`) isn't tied to a workspace, so with several organizations, AI Gateway uses the user's effective group for budgets. The page doesn't mention this. - The Nitro (coder/registry#1253) and Cilium (coder/registry#1254) registry templates are still open, so they aren't linked yet. <details> <summary>Decisions and checks</summary> - **Structure:** three traits, several ways to get each, and simple tradeoffs. - **Sysbox** is not listed as kernel isolation, because system calls still reach the node's kernel. - **Deployments** stay the recommendation over bare Pods, because `wait_for_rollout` and coder-logstream-kube cover the startup and error cases. - **Token lifetime** is left commented out in the example: Coder can't revoke the token at stop, and a lifetime shorter than autostop breaks running workspaces. - **Process logging** wording: the eBPF sidecar runs inside the sandbox with gVisor, Kata, or Nitro, so the page asks readers to test it. - **"CLI Agents"** is kept as the term for agents that run fully in the workspace. - **Verified in code:** - `mutable = false` is enforced on later builds (`coderd/dynamicparameters/resolver.go`). - Presets match by subset, also without a `preset_id` (`coderd/database/queries/prebuilds.sql`, `coderd/workspaces.go`). - `no_user_data` blocks the Git SSH key and external auth (`coderd/gitsshkey_test.go`, `coderd/externalauth_test.go`). - Token creation is rejected for the prebuilds system user (`coderd/apikey.go`), and the default token lifetime is 7 days (`codersdk/deployment.go`). - No Coder code sets `CODER_SESSION_TOKEN` in a workspace; registry modules such as `coder-login` do. - **Checks run:** `make lint/emdash`, `make lint/docs-html`, `make lint/docs-manifest`, markdownlint, markdown-table-formatter, Vale (0 errors), and the pre-commit hook. </details> 🤖 This PR was generated by Coder Agents on behalf of @bpmct.
bpmct
marked this pull request as ready for review
November 24, 2026 11:41
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a
coder-labstemplate that runs each workspace in a plain Kubernetes Pod, with Cilium as the firewall. It is the Cilium sibling of Plain Sandbox (Kubernetes) (#1232): the same profiles, presets, and apps, but CiliumNetworkPolicies replace the Squid proxy and the NetworkPolicy.toFQDNs) on the profile's ports, and always denies private ranges. Profiles: Fully isolated (default), GitHub only, GitHub and package registries, Public internet, or Custom.cluster/adds a CiliumClusterwideNetworkPolicy that denies all traffic in the namespace and cloud metadata. So there is no start gate and no VPC CNI Pod-name workaround.gvisor,kata-qemu, orkata-clhinruntimesto offer them.cluster/is a small Terraform configuration for the namespace, the RBAC, CRD read access, and the baseline policy.cluster/README.mdshows Cilium in AWS VPC CNI chaining mode on its own node group, with Helm values.kubernetes-sandboxed/build/Dockerfile), the scoped AI Gateway token, and the code-server, git-clone, and Claude Code setup..icons/cilium.svgfrom cncf/artwork.Startup on EKS, create to connected agent: about 9 s from a prebuild, 20 to 42 s cold.
Type of Change
Template Information
Path:
registry/coder-labs/templates/kubernetes-ciliumTesting & Validation
terraform test: 29 template runs and 5cluster/runs, with mock providers). CI runs.tftest.hclonly for modules, so these do not run in CI.prettier --check,terraform fmt), README validator and ShellCheck passcluster/from this PR.Live test results
gist.github.com, example.com blocked*.nip.io) blocked*.npmjs.org, gVisor, cold4.19.0-gvisor,registry.npmjs.organdnpmjs.org200, GitHub and port 80 blockedRetest on 2026-11-24 (head `ece0872`, Coder v2.39.4-devel)
Pushed this branch to the live deployment and ran the Network check app in a new workspace for each case. All matched the README. Deleting each workspace removed its Pod, PVC, and both CiliumNetworkPolicies.
*.example.com,github.comexample.com,www.example.com, andgithub.comallowed.api.github.comand npm blocked10.0.0.1Decisions
kubernetes_manifestneeds every list element to have the same attributes, so unused ones are null. A nullrulesobject still reaches the API as{}, which the CRD rejects. So the DNS rule, the only one with L7 rules, is in its own policy.dns_server), not kube-dns: in chaining mode, CoreDNS runs on nodes without Cilium. Cilium sees the CoreDNS Pod addresses after Service translation, and those change. The default is the Amazon VPC resolver.*. This blocks DNS lookups for other names, and it is the L7 part of the policy.coder_egress_cidrs, so a public name that resolves to a private address stays blocked.node_selectordefaults tocoder.com/pool=cilium, to matchcluster/cilium-values.yaml. With{}on a mixed cluster, a Pod could land on a node without Cilium and have no firewall.operator.unmanagedPodWatcher.restart: falseand a custom IPAM pool in the example values: with Cilium on some nodes only, the default restarts every Pod on the other nodes, and the default pool10.0.0.0/8holds the EKS service CIDR.Comparison with the Cilium pilot in coder/dogfood
Both chain Cilium onto VPC CNI on selected nodes, keep kube-proxy, turn off the unmanaged Pod restart, move the IPAM pool, and select the workspace by
com.coder.workspace.id./32s, marked pilot only. Any name answeredReview
A Claude review found no blockers. Fixed: the
node_selectordefault (it was{}, which fails open on a mixed cluster), a metadatadns_server(it now fails validation),coder_egress_cidrsthat hold a whole private range or are not in network form, a lowercase access host, wording on ingress from the local node and on shared CDN addresses, and more tests (manifest shape, private IP access URL, ports, git-clone, AI Gateway). Not changed: IPv6 deny entries (IPv4 only, as documented), and TLS server name rules through Envoy, which could be a follow-up.Related Issues
None
🤖 This PR was generated by Coder Agents on behalf of @bpmct.