npx skills add ...
npx skills add nvidia/openshell --skill helm-dev-environment
Start up, tear down, and configure the local Kubernetes development environment for OpenShell. Uses k3d (Docker-backed k3s) + Skaffold + Helm. Covers cluster lifecycle, optional add-ons (Keycloak OIDC, Envoy Gateway), HA testing, and port mappings. Trigger keywords - local k8s, local cluster, k3d, skaffold, helm dev, start cluster, stop cluster, tear down cluster, delete cluster, create cluster, helm:k3s, helm:skaffold, local dev environment, dev cluster, k8s dev, envoy gateway local, keycloak local, high availability, HA.
npx skills add nvidia/openshell --skill helm-dev-environment
Set up, run, and tear down the local Kubernetes development environment for OpenShell.
The stack is: k3d (Docker-backed k3s) for the cluster, Skaffold for image builds and Helm deploys, and the OpenShell Helm chart (deploy/helm/openshell/).
mise install completed (provides k3d, kubectl, skaffold, helm)Creates a k3d cluster and merges its kubeconfig into the worktree-local kubeconfig file.
When the named cluster already exists, the task starts any stopped containers and refreshes
same-named kubeconfig entries so a recreated load balancer's current API port takes effect.
Also applies the upstream agent-sandbox CRDs/controller (pinned via AGENT_SANDBOX_VERSION
in tasks/scripts/helm-k3s-local.sh, fetched from github.com/kubernetes-sigs/agent-sandbox
releases), enables its OTLP tracing on v0.5 and later, installs an OTLP trace
collector and UI in the observability namespace,
and preloads the default community sandbox image into k3d so the first sandbox create
does not wait on a large registry pull. Traefik is disabled at cluster creation time.
Multi-worktree support: the cluster name is derived from the last component of the
current git branch (e.g. branch kube-support/local-dev/tmutch → cluster
openshell-dev-tmutch). Each worktree therefore gets its own isolated cluster and its
own kubeconfig file. Override with HELM_K3S_CLUSTER_NAME to force a specific name
or share one cluster across worktrees.
Port mappings created at cluster time (cannot be changed without recreating):
| Host port | Target | Used by |
|---|---|---|
8080 | Port 80 via k3d load balancer | Envoy Gateway LoadBalancer service (values-gateway.yaml) |
Override with env vars before running helm:k3s:create:
HELM_K3S_LB_HOST_PORT (default: 8080)HELM_K3S_PRELOAD_SANDBOX_IMAGE (default:
ghcr.io/nvidia/openshell-community/sandboxes/base:latest; set to an empty value to skip)HELM_K3S_COLLECTOR_IMAGE (default:
mcr.microsoft.com/dotnet/aspire-dashboard:latest)HELM_K3S_COLLECTOR_HEALTH_TIMEOUT (default: 120 seconds)Iterative dev (rebuilds on file changes, recommended during active development):
One-shot deploy (build once and leave running):
The Skaffold flow builds distinct gateway, sandbox, and supervisor images
and deploys the OpenShell Helm chart. The Kubernetes driver creates a
capability-free workload Pod and a directly managed capability-free supervisor
Pod. One namespace-wide NetworkPolicy denies direct egress from every OpenShell
workload Pod. The
pkiInitJob hook (a pre-install Job that runs openshell-gateway generate-certs)
generates mTLS secrets on first install. The default Skaffold values export
gateway and Kubernetes-driver traces to the collector service installed by
helm:k3s:create. Envoy Gateway is opt-in; see the Optional Add-ons section.
The gateway Service uses ClusterIP. Access is via Envoy Gateway (port 8080) or
the unified local forwarding task:
The task forwards OTLP/gRPC to http://127.0.0.1:4317 and the trace UI to
http://127.0.0.1:18888. When Skaffold has deployed a Kubernetes gateway, it
also forwards the gateway to http://127.0.0.1:8090; otherwise it continues
with the collector ports only. A successful plaintext helm:skaffold:run
registers the gateway under the worktree-specific k3d
cluster name and selects it as the active gateway. Keep the forwarding
task running while using those endpoints.
The gateway exports OTLP/gRPC to
http://openshell-collector.observability.svc.cluster.local:4317 through the
default Skaffold values. Forward OTLP/gRPC and the trace UI to the host:
Open http://127.0.0.1:18888 and exercise the gateway to inspect gateway and
Kubernetes compute-driver spans under their distinct service names, along with
Agent Sandbox controller reconciliation spans linked through the Sandbox
trace-context annotation. The same command exposes OTLP/gRPC on
http://127.0.0.1:4317 and, when deployed, the Kubernetes gateway on
http://127.0.0.1:8090. The local gateway:docker, gateway:podman, and
gateway:vm tasks detect the collector listener at startup and enable trace
export only while it is reachable.
HA test deploy (two gateway replicas + external PostgreSQL Secret): uncomment
#- ci/values-high-availability.yaml in deploy/helm/openshell/skaffold.yaml,
create the Secret named openshell-ha-pg with a uri key, then run
mise run helm:skaffold:run or mise run helm:skaffold:dev.
ci/values-skaffold.yaml sets server.disableTls: true, so Skaffold-based deploys run
plaintext by default. Override server.disableTls=false to exercise TLS/mTLS.
| Mode | server.disableTls | Gateway scheme |
|---|---|---|
| Skaffold dev (default) | true | http:// |
| TLS enabled | false (or omitted) | https:// |
Port 8080 is already bound by the k3d load balancer when Envoy Gateway is
active, so the forwarding task uses local port 8090 for the gateway. In a
second terminal, confirm that the gateway is registered and active:
Plaintext (default Skaffold deploy):
With mTLS enabled — extract the client cert the PKI hook wrote to the cluster, then place it where the CLI expects it. Run once after each fresh install:
The server cert SANs include localhost and 127.0.0.1, so hostname verification
passes over a port-forward without any extra flags:
This removes the k3d cluster and all resources. Kubeconfig context is left behind but will point to a deleted cluster — safe to ignore or clean up manually.
Each add-on requires uncommenting the corresponding valuesFiles entry in
deploy/helm/openshell/skaffold.yaml before running helm:skaffold:dev or helm:skaffold:run.
Envoy Gateway is already installed by Skaffold (the envoy-gateway Helm release in
skaffold.yaml). To activate routing:
#- values-gateway.yaml in skaffold.yamlmise run helm:skaffold:runmise run helm:gateway:applyhttp://127.0.0.1:8080values-gateway.yaml creates a Gateway (listener on port 80, class eg) and a
GRPCRoute in the openshell namespace. Envoy Gateway provisions a LoadBalancer
service for the proxy; klipper-lb binds it to hostPort 80, reachable via the
8080:80 load balancer port mapping.
To enable end-to-end TLS between the Gateway proxy and the gateway pod, add BackendTLSPolicy values to the Helm install:
This requires server.tls.enableMtls=false because ingress proxies cannot
present client certificates to the backend. The certgen hook creates a backend
CA ConfigMap from the server Secret's ca.crt key. With cert-manager, a
separate post-install Job polls for the cert-manager-issued certificate (up to
pkiInitJob.timeoutSeconds); with built-in PKI the ConfigMap is created in the
same pre-install hook. The ConfigMap is reconciled on every upgrade so CA
rotations propagate automatically.
Key Helm values:
grpcRoute.backendTLSPolicy.enabled: create the BackendTLSPolicy resourcegrpcRoute.backendTLSPolicy.caCertificateConfigMapName: override ConfigMap namegrpcRoute.backendTLSPolicy.hostname: override backend validation hostnameserver.tls.enableMtls: must be false for BackendTLSPolicypkiInitJob.timeoutSeconds: polling duration for cert-manager modepkiInitJob.failOnTimeout: fail install if cert-manager times outInitial setup — rerun it whenever you want to rotate the development CA:
This deploys Keycloak (quay.io/keycloak/keycloak:24.0) into the keycloak namespace,
imports the openshell realm from scripts/keycloak-realm.json, generates a short-lived
development TLS certificate, and publishes its trust anchor as the
openshell-keycloak-ca ConfigMap in the OpenShell namespace. The command prints a
port-forward command for acquiring tokens from the CLI. Rerunning setup rotates the
development certificate and trust anchor; redeploy the gateway afterward so it reloads
the mounted CA bundle.
Then activate OIDC in the OpenShell Helm chart:
#- ci/values-keycloak.yaml in skaffold.yamlmise run helm:skaffold:runTo remove Keycloak:
Skaffold can install SPIRE with the SPIFFE hardened Helm charts. To activate SPIFFE JWT-SVIDs for dynamic provider token grants:
spire-crds and spire releases in deploy/helm/openshell/skaffold.yaml#- ci/values-spire.yaml in the OpenShell release values filesmise run helm:skaffold:runci/values-spire-stack.yaml configures the local SPIRE trust domain as
openshell.local and adds a ClusterSPIFFEID that maps sandbox pod
annotations to spiffe://openshell.local/openshell/sandbox/<sandbox-id>.
OpenShell mounts the SPIFFE CSI Workload API socket at
/spiffe-workload-api/spire-agent.sock only into supervisor Pods for provider token
grants. Supervisor-to-gateway authentication remains on the Kubernetes
ServiceAccount bootstrap and gateway-minted sandbox JWT path; the selected
Kubernetes compute driver validates the projected token before the gateway
mints its JWT.
The credential-driver-vault Skaffold profile applies
ci/values-credential-driver-vault.yaml. Its external OpenBao/Vault backend
must expose HTTPS at the configured service DNS name and publish the issuing CA
certificate as the ca.crt key in the openbao-ca ConfigMap. Local e2e uses
OpenBao dev TLS and an openbao-0 DNS alias matching its generated certificate.
The Helm value
server.credentialDrivers.vault.caConfigMapName mounts that key into the
gateway and renders the driver's ca_bundle setting. Non-loopback HTTP
addresses fail gateway startup, and hostname verification requires the service
DNS name in the server certificate SANs.
Stop the cluster without losing state (faster than delete/recreate):
Check cluster status:
Run the chart lint task before changing Helm templates, values overlays, or Skaffold inputs:
If Helm reports missing chart dependencies, remove the specific stale subchart
archive or directory named by the error from deploy/helm/openshell/charts/,
then rerun the lint task.
For example, when lint reports chart metadata is missing these dependencies: postgresql, remove stale PostgreSQL chart artifacts:
The charts/ directory is ignored and regenerated by helm dependency build
for dependencies still declared in Chart.yaml.
| Path | Purpose |
|---|---|
deploy/helm/openshell/skaffold.yaml | Skaffold config — images, Helm releases, values overlays |
deploy/helm/openshell/values.yaml | Default Helm values |
deploy/helm/openshell/ci/values-skaffold.yaml | Dev overrides (image pull policy, TLS disabled for local Skaffold) |
deploy/helm/openshell/ci/values-cert-manager.yaml | cert-manager PKI overlay (opt-in; disables pkiInitJob) |
deploy/helm/openshell/ci/values-gateway.yaml | Envoy Gateway GRPCRoute + Gateway overlay |
deploy/helm/openshell/ci/values-high-availability.yaml | HA test overlay (replicaCount: 2 with external PostgreSQL Secret) |
deploy/helm/openshell/ci/values-keycloak.yaml | Keycloak OIDC overlay |
deploy/helm/openshell/ci/values-spire.yaml | SPIFFE/SPIRE provider token grant overlay |
deploy/helm/openshell/ci/values-spire-stack.yaml | SPIRE hardened chart values for local dev |
deploy/helm/openshell/ci/values-tls-disabled.yaml | Lint-only: TLS + auth disabled (reverse-proxy edge termination) |
deploy/helm/openshell/ci/values-credential-driver-vault.yaml | Vault credential-driver validation overlay with HTTPS and private-CA trust |
deploy/kube/manifests/envoy-gateway-openshell.yaml | GatewayClass for Envoy Gateway (mise run helm:gateway:apply) |
tasks/scripts/helm-k3s-local.sh | k3d cluster create/delete/start/stop/status |
tasks/scripts/keycloak-k8s-setup.sh | Keycloak deploy, realm import, and development TLS trust anchor |