k8s_sandbox

command
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Example: k8s_sandbox runs an untrusted command as a one-shot Kubernetes Job using the K8s sandbox backend. Each execution creates a hardened Job (non-root, all capabilities dropped, no privilege escalation, read-only root filesystem), waits for it to finish, collects the pod's logs and exit code, and deletes the Job.

This example needs a reachable Kubernetes cluster. It resolves credentials the same way kubectl does: the in-cluster service account when running inside a pod, otherwise your local kubeconfig (KUBECONFIG or ~/.kube/config). With no cluster configured it prints setup guidance and exits cleanly.

# Point kubectl at a cluster first (any of these work):
#   kind create cluster        (https://kind.sigs.k8s.io)
#   minikube start
#   k3d cluster create
go run ./examples/k8s_sandbox/

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL