Cloud.KubernetesScheduledSnapshot
A schedule that creates snapshots of a KubernetesCluster’s control
plane: hourly, daily, weekly or monthly (a monthly schedule runs on
the same day each month). A snapshot captures the cluster’s state on the
control plane, not the workers or persistent volume data (use volume
snapshots for those); restoring one rolls the cluster back in place.
Snapshots and their schedule are removed with the cluster.
frequency changes in place; kubernetesClusterId and
availabilityZone replace the schedule. The API has no endpoint for one
schedule, so it is read through the cluster’s list of schedules.
Ownership. The API keeps no metadata for it and it has no generated name,
so nothing marks it as this stack’s: list enumerates it under every parent, and a
create interrupted before its state was saved is not recognised by the next deploy
(which creates it again, or gets the API’s conflict when its identity is unique).
Zone. A child doesn’t take its zone from its parent: it uses its own
availabilityZone, else the credentials’ zone. When the parent lives in
another zone, pass the parent’s along (availabilityZone: parent.availabilityZone), or every call for it answers NotFound.
Scheduling snapshots
Section titled “Scheduling snapshots”A daily snapshot of the control plane
const cluster = yield* BetterStack.Cloud.KubernetesCluster("k8s", {});yield* BetterStack.Cloud.KubernetesScheduledSnapshot("daily", { kubernetesClusterId: cluster.id, frequency: "daily",});Looking up an existing schedule
Section titled “Looking up an existing schedule”Reference a schedule by cluster and id
const existing = BetterStack.Cloud.KubernetesScheduledSnapshot.lookup({ kubernetesClusterId: "42", id: "7",});frequency "monthly" | "hourly" | "daily" | "weekly" | string required
How often to create a snapshot. A monthly schedule runs on the same day each month.
kubernetesClusterId string required
The ID of the parent this kubernetes cluster belongs to.
availabilityZone string
Availability zone the resource lives in, such as us-west-2a. Defaults to the credentials' zone (BETTERSTACK_AVAILABILITY_ZONE, or the profile's). Changing it replaces the resource. A child of a resource in another zone (a firewall rule, a node pool, a snapshot of an instance outside the credentials' zone) must repeat the parent's availabilityZone: it receives only the parent's id, so its zone cannot be derived.
Attributes
Section titled “Attributes”availabilityZone string always set
Availability zone the resource lives in, such as us-west-2a.
id string always set
The schedule's ID.
kubernetesClusterId string always set
The ID of the Kubernetes cluster the schedule belongs to.
createdAt string
When the schedule was created.
frequency "monthly" | "hourly" | "daily" | "weekly"
How often to create a snapshot. A monthly schedule runs on the same day each month.
lastRunAt string | null
When the schedule last created a snapshot, or null until the schedule first runs.
serverId string
The ID of the server that runs the cluster's control plane.
updatedAt string
When the schedule was last updated.
Lookup
Section titled “Lookup”KubernetesScheduledSnapshot.lookup(props) reads an object this stack does not manage. It is never created, updated or deleted.
id string required
The schedule's ID.
kubernetesClusterId string required
The ID of the Kubernetes cluster.
availabilityZone string
Zone the cluster lives in. Defaults to the credentials' zone.