Rivet.Kubernetes reference
DeploymentPool
Section titled “DeploymentPool”Source:
packages/rivet/src/Kubernetes/DeploymentPool.ts
Run a pool’s nodes on Kubernetes: a pool on the control plane, and a
Deployment whose pods host every Rivet.DurableObject given this pool.
Nodes only connect out to the control plane, so they need no Service of
their own. On the control plane’s own cluster they connect inside it;
on another cluster, at the control plane’s public endpoint.
Every Durable Object given the same pool shares its nodes: declare the pool once and provide it to each class.
DeploymentPool: Running Durable Objects on Kubernetes
Section titled “DeploymentPool: Running Durable Objects on Kubernetes”Nodes beside the control plane
export const Cluster = RivetKubernetes.StatefulSetControlPlane("Rivet", { cluster: EksCluster });export const Default = RivetKubernetes.DeploymentPool("Default", { replicas: 3 }).pipe( Layer.provide(Cluster),);Nodes on another cluster, against Rivet Cloud
export const Default = RivetKubernetes.DeploymentPool("Default", { cluster: GkeCluster }).pipe( Layer.provide(RivetCloud.ControlPlane()),);ServicesPool
Section titled “ServicesPool”Source:
packages/rivet/src/Kubernetes/ServicesPool.ts
Run Rivet Services on Kubernetes: the services pool on the control
plane, and a Deployment running Rivet’s prebuilt Services node, which
hosts Durable Streams and agentOS. Its Pods only connect out: callers
reach every stream through the control plane’s gateway, with its token.
ServicesPool: Running Rivet Services on Kubernetes
Section titled “ServicesPool: Running Rivet Services on Kubernetes”export const Cluster = RivetKubernetes.StatefulSetControlPlane("Rivet", { cluster });export const Services = RivetKubernetes.ServicesPool("Services").pipe(Layer.provide(Cluster));StatefulSetControlPlane
Section titled “StatefulSetControlPlane”Source:
packages/rivet/src/Kubernetes/StatefulSetControlPlane.ts
A Rivet control plane on Kubernetes, as a Rivet.Cluster Layer: a
StatefulSet of engines, each with a volume of its own, a Service for the
API, a headless Service for the engines’ peer traffic, the admin token in
a Secret, and a namespace for the stage. Runs on any cluster — EKS, GKE,
AKS, a local kind cluster.
One engine keeps actor data on its own volume. More need shared object
storage (objectStorage: S3, an S3-compatible service, or GCS) reached
over HTTPS. Pools of nodes on the same cluster — RivetKubernetes.DeploymentPool —
connect to the engines inside the cluster.
StatefulSetControlPlane: Running a control plane on Kubernetes
Section titled “StatefulSetControlPlane: Running a control plane on Kubernetes”Three engines behind a load balancer, data in S3
export const Cluster = RivetKubernetes.StatefulSetControlPlane("Rivet", { cluster: EksCluster, instances: 3, objectStorage: { kind: "s3", bucket: "my-rivet-data", region: "us-west-2" },});One engine on a local kind cluster
export const Cluster = RivetKubernetes.StatefulSetControlPlane("Rivet", { cluster: Kind, expose: { type: "NodePort", nodePort: 30642, endpoint: "http://localhost:16450" },});