ai newsDi., 1. Dez.

AWS Nitro Sandboxes: Jeder EKS-Pod bekommt eine eigene MicroVM

AWS Nitro Sandboxes laufen jeden optierten EKS-Pod, ECS-Task oder EC2-Workload in einer eigenen Firecracker-MicroVM mit separatem Kernel, aktiviert über ein einziges runtimeClassName-Feld ohne Zusatzkosten. Ein Confidential Mode ergänzt attestation-gesteuerte Schlüsselfreigabe.

InfoQMontag 10:07 · 16.11.DE4 Min. Lesezeit
Bild: InfoQ

Die Funktion ist in allen kommerziellen Regionen ohne zusätzliche Kosten verfügbar, und AWS positioniert sie für Workloads, bei denen weder dem Tenant noch dem Code vertraut werden kann, wobei Coding-Agents an erster Stelle genannt werden. In einem AWS-Blogbeitrag schreiben Carlos Santana und Trishi Mehta:

Jeder Pod erhält sein eigenes Betriebssystem, vollständig getrennt vom Host und von jedem Nachbarn.

Laut der EKS-Dokumentation startet ein containerd-shim-nitro-sandbox-v2-Prozess auf der Parent-Instanz eine Firecracker-MicroVM als Guest der ersten Ebene mit hardwaregestützter Virtualisierung, woraufhin ein Agent innerhalb der VM die Container des Pods über ein eigenes containerd ausführt und beide Seiten über virtio und vsock kommunizieren. Das Ergebnis ist eine Sandbox, die weder Kernel noch Memory-Mappings mit der Parent-Instanz oder einer anderen Sandbox teilt, während die Container selbst unverändert starten. Wie die Knoten dorthin gelangen, hängt vom Cluster-Typ ab: Im EKS Auto Mode werden die beiden RuntimeClasses mit jedem Cluster ausgeliefert und sandbox-fähige Knoten bei Bedarf bereitgestellt, während bei einem Standard-EKS ein Team ein sandbox-fähiges AMI für seine Node Groups oder Karpenter erstellt.

Was die beiden Modi unterscheidet, ist die Frage, welcher Seite der Grenze vertraut wird. Der isolierte Modus vertraut der Parent-Instanz und nicht dem Gast, weshalb kubectl exec, Logs und die Prozessliste weiterhin funktionieren, während der Confidential-Modus die Parent-Instanz als nicht vertrauenswürdig behandelt und die Durchsetzung in die VM verlagert: Eine aus der Pod-Spezifikation generierte Cedar-Policy legt Image-Digests, Argumente, Umgebung, Mounts und Capabilities fest, exec und stdin werden verweigert, das Nitro Secure Module misst das Image und die Policy in PCRs, und eine KMS-Schlüsselrichtlinie kann Secrets nur an eine Sandbox freigeben, deren Messungen übereinstimmen. Auch Image-Layer können verschlüsselt werden, sodass die Parent-Instanz Ciphertext bewegt, den sie nie liest.

Diese Kette hält nur, wenn etwas die Messungen prüft, und genau das sagt die Dokumentation: Ohne eine KMS-Richtlinie oder einen externen Verifier, der die PCR-Werte prüft, wird die Attestationsmessung zwar aufgezeichnet, aber nie verifiziert, und die Vertraulichkeitsgarantien des Confidential-Modus bleiben unvollständig. Unabhängig von beiden Modi startet eine Netzwerk-isolierte Annotation die Sandbox ohne jedes Netzwerkgerät, was auch DNS, NTP, IMDS und Pod Identity entfernt und HTTP- sowie TCP-Probes unbrauchbar macht.

Sandip Das, ein AWS Container Hero, las die Dokumentation auf dieselbe Weise und arbeitete heraus, was der isolierte Modus dem Betreiber überlässt: Der Schutz wirkt nur in eine Richtung, sodass ein kompromittierter Parent weiterhin unverschlüsselten Datenverkehr und DNS beobachten oder manipulieren, die Datei /etc/hosts des Pods schreiben und Pod-Identity-Credentials für jeden Pod auf dem Knoten ausstellen kann. Er listet zudem Voraussetzungen auf, die der Blogbeitrag nicht nennt, darunter Kubernetes 1.36 oder neuer, ein Launch Template mit aktivierten Nitro Enclaves in Managed Node Groups, ohne die sandboxierte Pods im Zustand Pending verharren, sowie Pod Identity statt IRSA für Credentials. Zu AWSs Beschreibung der Leistung als nahezu nativ rät er, dies als Herstellerangabe zu betrachten und die Startlatenz, den I/O-Durchsatz und die Tail-Latenz selbst zu benchmarken.

Über Agents hinaus nennt AWS Multi-Tenant-SaaS, regulierte Workloads, CI-Builds und Remote-IDEs und verweist auf das Open-Source-Projekt agent-sandbox für Warm Pools, die eine vorgebootete VM in etwa zwei Sekunden ausgeben.

Die Einschränkungen stehen auf der Seite mit den Hinweisen, und die größte betrifft GPU- und Device-Passthrough, das zum Start nicht unterstützt wird, weil Firecracker keine Host-Geräte an einen Gast durchreichen kann; GPU-Pods laufen daher ohne die Sandbox-Klasse. Die Dichte ist doppelt begrenzt: Die Gesamtzahl der Sandbox-vCPUs darf das Fünffache der vCPU-Anzahl des Knotens nicht überschreiten, und ebenso wenig die Anzahl der Sandboxes, halbiert bei Typen mit CPU-Overcommit, was einem Knoten mit 4 vCPUs Platz für zwanzig 1-vCPU-Sandboxes oder fünf 4-vCPU-Sandboxes gibt. Simultanes Multithreading kostet mehr als die Rechung vermuten lässt, denn Core-Scheduling verbietet zwei Sandboxes das Teilen der Sibling-Threads eines Kerns und lässt grob die Hälfte der beworbenen vCPUs nutzbar; Graviton mit einem Thread pro Kern ist davon nicht betroffen.

Der nächste Vergleichspunkt ist GKE Sandbox, das seit 2019 eine gvisor-RuntimeClass anbietet und neuerdings eine auf Kata Containers und Cloud Hypervisor basierende microvm-Klasse. gVisor fängt Systemcalls in einem Userspace-Kernel ab, startet in unter 200 Millisekunden und unterstützt CUDA auf einem Teil der GPUs; Googles MicroVM-Option bringt fixe 250 mCPU und 130 MiB pro Pod mit, startet in ein bis zwei Sekunden und unterstützt keine GPUs. AWS hat sich für die VM-Seite dieser Aufteilung entschieden und drückt den Overhead in Dichte und Threads statt in Ressourcen pro Pod aus.

Auf EC2 werden Amazon Linux und Firecracker nativ unterstützt, und für andere Virtual-Machine-Monitore sind Patches verfügbar. Das EC2 User Guide enthält die Liste der unterstützten Instanzen und weist darauf hin, dass Snapshot, Restore und Live-Migration nicht verfügbar sind.

Vorgestellt von: David Iparraguirre, Senior Product Marketing Manager bei Datadog, und Jessica Yang, Product Managerin bei Datadog

Automatisch übersetzt. Das Original auf Englisch ist unten aufklappbar.

Original (Englisch) anzeigen

The feature is available in all commercial regions at no additional charge, and AWS positions it for workloads where the tenant or the code cannot be trusted, with coding agents named first. In an AWS blog post, Carlos Santana and Trishi Mehta write:

Each pod gets its own operating system, completely separate from the host and from every neighbor.

According to the EKS documentation, a containerd-shim-nitro-sandbox-v2 process on the parent instance launches a Firecracker microVM as a first-level guest with hardware-assisted virtualization, after which an agent inside the VM runs the pod’s containers through its own containerd and the two sides communicate over virtio and vsock. The result is a sandbox that shares neither kernel nor memory mappings with the parent instance or any other sandbox, while the containers themselves start unchanged. How the nodes get there depends on the cluster type: on EKS Auto Mode the two RuntimeClasses ship with every cluster and sandbox-capable nodes are provisioned on demand, whereas on standard EKS a team builds a sandbox-enabled AMI for its node groups or Karpenter.

What separates the two modes is which side of the boundary is trusted. Isolated mode trusts the parent instance and not the guest, which is why kubectl exec, logs, and process listing keep working, whereas confidential mode treats the parent as untrusted and moves enforcement inside the VM: a Cedar policy generated from the pod spec pins image digests, arguments, environment, mounts and capabilities, exec and stdin are denied, the Nitro Secure Module measures the image and policy into PCRs, and a KMS key policy can release secrets only to a sandbox whose measurements match. Image layers can be encrypted as well, so the parent moves ciphertext it never reads.

That chain only holds if something checks the measurements, and the documentation says so: without a KMS policy or external verifier checking the PCR values, "the attestation measurement is recorded but never verified, and the confidentiality guarantees of confidential mode are incomplete." Separately from either mode, a network-isolated annotation boots the sandbox with no network device at all, which also removes DNS, NTP, IMDS and Pod Identity and breaks HTTP and TCP probes.

Sandip Das, an AWS Container Hero, read the documentation the same way and drew out what isolated mode leaves to the operator: the protection "only runs in one direction," so a compromised parent can still observe or tamper with unencrypted traffic and DNS, writes the pod's /etc/hosts, and can mint Pod Identity credentials for any pod on the node. He also lists prerequisites the blog post does not, among them Kubernetes 1.36 or later, a launch template with Nitro Enclaves enabled on managed node groups, without which "sandboxed pods sit in Pending," and Pod Identity rather than IRSA for credentials. On AWS's description of performance as near-native, he advises treating it "as a vendor claim" and benchmarking startup latency, I/O throughput and tail latency.

Beyond agents, AWS lists multi-tenant SaaS, regulated workloads, CI builds and remote IDEs, and points to the open-source agent-sandbox project for warm pools that hand out a pre-booted VM in about two seconds.

The constraints are on the considerations page, and the largest is GPU and device passthrough, which is not supported at launch because Firecracker cannot pass host devices into a guest, so GPU pods run without the sandbox class. Density is capped twice over: total sandbox vCPUs may not exceed five times the node's vCPU count, and neither may the number of sandboxes, halved on CPU-overcommit types, which gives a 4-vCPU node room for twenty 1-vCPU sandboxes or five 4-vCPU ones. Simultaneous multithreading costs more than the arithmetic suggests, because core scheduling stops two sandboxes sharing the sibling threads of one core and leaves roughly half the advertised vCPUs usable; Graviton, with one thread per core, is unaffected.

The nearest comparison is GKE Sandbox, which has offered a gvisor RuntimeClass since 2019 and more recently a microvm class built on Kata Containers and Cloud Hypervisor. gVisor intercepts syscalls in a user-space kernel, starts in under 200 milliseconds and supports CUDA on a subset of GPUs; Google's microVM option carries a fixed 250 mCPU and 130 MiB per pod, starts in one to two seconds and does not support GPUs. AWS has taken the VM side of that split and expressed its overhead as density and threads rather than per-pod resources.

On EC2, Amazon Linux and Firecracker are supported natively and patches are available for other virtual machine monitors. The EC2 User Guide carries the supported instance list and notes that snapshot, restore and live migration are not available.

Presented by: David Iparraguirre - Senior Product Marketing Manager at Datadog, and Jessica Yang - Product Manager at Datadog

Originaltitel: AWS Nitro Sandboxes Put Each EKS Pod in its Own MicroVM with One RuntimeClass FieldQuelle: InfoQ (InfoQ). Original öffnen