@skaile/provider-k8s
v0.2.0
Published
Kubernetes (ClusterIP + port-forward) deploy target for @skaile/workspaces
Readme
@skaile/provider-k8s
A Kubernetes deploy target for
@skaile/workspaces. v0.1.0
stands a workspace up as a Pod behind a ClusterIP Service and reaches it over a
local kubectl port-forward tunnel.
Install
skaile plugin install @skaile/provider-k8sThe @kubernetes/client-node SDK is an optional peer dependency — install it
in your project so the provider can lazy-load it at runtime:
npm install @kubernetes/client-nodeAdd it to skaile.yaml:
plugins:
- "@skaile/provider-k8s@^0.1.0"
deploy:
target: k8s
config:
namespace: default
image: ghcr.io/me/workspace:1
port: 8080Config
| Field | Type | Default | Notes |
|---|---|---|---|
| namespace | string | default | Target namespace |
| image | string | — | Workspace image (required — bring-your-own) |
| port | number | 8080 | Container + service port |
| serviceAccount | string | — | Pod service account |
| env | record | {} | Extra container env |
| serviceType | ClusterIP | ClusterIP | Only ClusterIP in v0.1.0 |
| localForwardPort | number | — | Local port for the forward tunnel |
| buildStrategy | local \| remote \| managed | local | k8s is bring-your-own-image |
How it works
@kubernetes/client-nodeis lazy-loaded via a dynamicimport()insidecreate()/restore(), so this package builds and typechecks without the SDK installed (offline-safe).- Creates a Pod + ClusterIP Service and waits for the Pod to reach
Running. - The provider itself spawns and manages a
kubectl port-forward svc/<name>tunnel — you don't establish it. It resolves oncekubectlreports it is forwarding, exposesws://127.0.0.1:<bound-local-port>(the portkubectlactually bound, honouringlocalForwardPortwhen set or letting the OS pick a free one otherwise), and kills the child process onstop().restore()re-establishes the tunnel, preferring the previously bound port. tlsTermination: "edge"(TLS terminates at the cluster ingress; the port-forward tunnel is loopback-only on the operator's machine).
Limitations (v0.1.0)
- ClusterIP + port-forward only. NodePort / LoadBalancer / Ingress are future work (they add ingress class, annotations, and TLS cert source knobs).
- Bring-your-own-image: in-cluster builds are not performed.
- Requires
@kubernetes/client-nodeand a working kubeconfig in the host environment at runtime.
