kubernetes
Experimental. For evaluation. Interfaces, configuration, and behavior may change incompatibly.
Synchronizes Kubernetes node inventory and supports node, pod and custom-resource operations. Workflows must supply their own draining and eviction integration.
Prerequisites
- Kubernetes API access.
- Worker-readable kubeconfig with credentials and node-list permission.
Setup
- Mount the kubeconfig and add tenant TOML:
- Replace the path and context with your own.
This module must be enabled in your Remediation Orchestrator config before it is available to scripts.
This module provides functionality for interacting with Kubernetes clusters.
Members
- external_remediation_gvr
- maintenance_request_gvr
- bulk_add_taint
- bulk_remove_node_labels
- bulk_remove_taint
- bulk_set_node_labels
- check_connectivity
- create_idle_blocker_pod
- create_maintenance_request
- create_pod
- delete_idle_blocker_pod
- delete_maintenance_request
- delete_pod
- describe_pod
- exec_in_pod
- export_daemonsets
- export_events
- export_node
- export_pod
- export_pods
- get_cr
- get_node
- get_pod_logs
- gvr
- list_crs
- list_idle_blocker_pods
- list_node_details
- list_node_pods
- list_nodes
- list_pods
- mark_cr_complete
- on_cordon
- on_cr_created
- on_external_remediation
- on_external_remediation_all_configured_clusters
- on_taint
- pod_handle
- remove_node_label
- remove_node_status_condition
- remove_taint
- run_pod
- set_cr_condition
- set_node_label
- set_node_status_condition
- tenant_pod_handle
- uncordon
- update_cr_metadata
- update_cr_status
- wait_for_cr_change
external_remediation_gvr
kubernetes.external_remediation_gvrkubernetes.GVRThe default GroupVersionResource for NVSentinel ExternalRemediationRequest CRs.
maintenance_request_gvr
kubernetes.maintenance_request_gvrkubernetes.GVRThe default GroupVersionResource for NVSentinel MaintenanceRequest CRs.
bulk_add_taint
kubernetes.bulk_add_taint(nodes, key, value?, effect?)Add one taint to many nodes: any existing taint with the same key is replaced regardless of effect, and other taints are never touched. Fail-forward: per-node failures come back in the result while successes stand, with no rollback. The cluster is the tenant’s single configured cluster, never a parameter. Example: result = kubernetes.bulk_add_taint([“node-1”, “node-2”], “screening.example.com/role”); failed = result.failures. Can only be called from within a Temporal workflow.
nodeslist[string]Node names to taint (max 1000 per call).keystringThe key of the taint to add.value?optionalstringThe value of the taint.effect?optionalstringThe taint effect: NoSchedule, PreferNoSchedule, or NoExecute.resultkubernetes.BulkNodeMutationResultBulkNodeMutationResult with per-node failure reasons; nodes absent from it succeeded.bulk_remove_node_labels
kubernetes.bulk_remove_node_labels(nodes, keys)Remove label keys from many nodes: a node carrying none of the keys counts as success, and other labels are never touched. Fail-forward: per-node failures come back in the result while successes stand, with no rollback. The cluster is the tenant’s single configured cluster, never a parameter. Example: result = kubernetes.bulk_remove_node_labels([“node-1”, “node-2”], [“screening.example.com/role”]); failed = result.failures. Can only be called from within a Temporal workflow.
nodeslist[string]Node names to remove the labels from (max 1000 per call).keyslist[string]The label keys removed from every node (max 256 per call).resultkubernetes.BulkNodeMutationResultBulkNodeMutationResult with per-node failure reasons; nodes absent from it succeeded.bulk_remove_taint
kubernetes.bulk_remove_taint(nodes, key)Remove the taint with the given key from many nodes, leaving taints under other keys untouched; a node without the taint is a success. Fail-forward: per-node failures come back in the result while successes stand, with no rollback. The cluster is the tenant’s single configured cluster, never a parameter. Example: result = kubernetes.bulk_remove_taint([“node-1”, “node-2”], “screening.example.com/role”); failed = result.failures.
nodeslist[string]Node names to remove the taint from (max 1000 per call).keystringThe key of the taint to remove.resultkubernetes.BulkNodeMutationResultBulkNodeMutationResult with per-node failure reasons; nodes absent from it succeeded.bulk_set_node_labels
kubernetes.bulk_set_node_labels(nodes, labels)Set labels on the given nodes in one call: each requested key is written, other labels are never touched. The batch is not atomic and fails forward: per-node failures come back in the result while successes stand, with no rollback, and a node already carrying the requested values counts as success. The cluster is the tenant’s single configured cluster, never a parameter. Example: result = kubernetes.bulk_set_node_labels([“node-1”], {“screening.example.com/role”: “screening”}); failed = result.failures.
nodeslist[string]Names of the nodes to label. At most 1000 per call.labelsdict[string:string]Labels set on every node (e.g. {“screening.example.com/role”: “screening”}).resultkubernetes.BulkNodeMutationResultBulkNodeMutationResult with per-node failure reasons; nodes absent from it succeeded.check_connectivity
kubernetes.check_connectivity()Verify Kubernetes server discovery and bounded node and pod list access for one configured context.
resultdict[string:any]Dictionary containing cluster_name, server_version, node_count, and pod_count.create_idle_blocker_pod
kubernetes.create_idle_blocker_pod(cluster, node, namespace?, image?)Create a minimal pod pinned to a node that prevents the node from appearing idle. The pod persists until deleted. Idempotent: returns the existing pod if one is already present on the node. Intent is keyed to the node’s Kubernetes UID.
clusterstringThe name of the cluster.nodestringThe name of the node to schedule on.namespace?optionalstringThe namespace for the pod. Defaults to the tenant idle_blocker_namespace setting (“default” when unset).image?optionalstringThe container image to use.podkubernetes.PodHandlePodHandle for use with delete_pod or delete_idle_blocker_pod.create_maintenance_request
kubernetes.create_maintenance_request(cluster, name, health_event, start_time)Create an NVSentinel MaintenanceRequest to take a node offline for externally initiated maintenance. Can only be called from within a Temporal workflow.
clusterstringThe name of the cluster.namestringThe name of the MaintenanceRequest CR.health_eventdict[string:any]The NVSentinel HealthEvent payload describing the maintenance and requested action.start_timestringThe maintenance window start time in RFC3339 format.create_pod
kubernetes.create_pod(name, cluster, namespace, node, image?, env?, ttl?, gpu_count?)Create a long-running pod on a specific node for running commands via exec_in_pod. The pod is automatically deleted after the TTL expires. Call delete_pod when done to clean up early.
namestringA name for this pod session. Used in the pod name for identification. Must be unique within a workflow run.clusterstringThe name of the cluster.namespacestringThe namespace for the pod.nodestringThe name of the node to schedule on.image?optionalstringThe container image to use.env?optionaldict[string:string]Environment variables as a dict.ttl?optionalstringTime-to-live for the pod as a duration string (e.g. ‘4h’, ‘168h’). Pod exits after this duration. Defaults to 168h (7 days).gpu_count?optionalintNumber of nvidia.com/gpu to request on the container. Required for nvidia-smi or CUDA access. Defaults to 0 (no GPU).podkubernetes.PodHandlePodHandle with pod_name for use with exec_in_pod and delete_pod.delete_idle_blocker_pod
kubernetes.delete_idle_blocker_pod(cluster, node, namespace?, wait?)Delete the idle-blocker pod on a node and mark the intent released for the current node’s Kubernetes UID. Sync does not recreate the pod for that UID. Safe to call if the pod has already been deleted.
clusterstringThe name of the cluster.nodestringThe name of the node the idle-blocker pod is pinned to.namespace?optionalstringThe namespace of the pod. Defaults to the stored intent namespace or tenant idle_blocker_namespace setting.wait?optionalboolWait for the pod to be fully deleted before returning. Defaults to True.delete_maintenance_request
kubernetes.delete_maintenance_request(cluster, name, expected_uid?, expected_resource_version?)Delete the inspected version of an NVSentinel MaintenanceRequest to end externally initiated maintenance. The UID and resource version must match. Can only be called from within a Temporal workflow.
clusterstringThe name of the cluster.namestringThe name of the MaintenanceRequest CR.expected_uid?optionalstringThe original request UID. Deletion requires this value.expected_resource_version?optionalstringThe metadata.resourceVersion from the inspected request. Deletion requires this value.delete_pod
kubernetes.delete_pod(pod, wait?)Delete a pod. Waits for full deletion by default. Safe to call if the pod has already been deleted.
podkubernetes.PodHandleThe PodHandle from create_pod or pod_handle.wait?optionalboolWait for the pod to be fully deleted before returning. Defaults to True.describe_pod
kubernetes.describe_pod(pod)Get details about a pod.
podkubernetes.PodHandleThe PodHandle from create_pod or pod_handle.detailskubernetes.SessionPodDetailSessionPodDetail with name, node, phase, image, and other metadata.exec_in_pod
kubernetes.exec_in_pod(pod, command, args?, timeout?, env?, container?, maximum_attempts?, keep_descendants_alive?)Execute a command in a running pod. Returns stdout, stderr, and exit code. Nothing is written in the pod: the kill finds the command through a tag in its environment (a command that scrubs its environment escapes it), and needs grep in the container image, plus tr when keep_descendants_alive is set.
podkubernetes.PodHandleThe PodHandle from create_pod or pod_handle.commandstringThe command to execute.args?optionallist[string]Literal arguments to append to the command; shell syntax belongs in command.timeout?optionalstringTimeout for the command as a duration string (e.g. ‘5m’, ‘1h’). Max 24h. Defaults to 5m. Counts from the first attempt’s schedule across retries; expiry kills the command in the pod.env?optionaldict[string:string]Environment variables as a dict. Values may use {secret:NAME} placeholders. Names must be shell identifiers.container?optionalstringContainer to exec into. Defaults to ‘executor’, the create_pod container name.maximum_attempts?optionalintMaximum Temporal activity attempts. Zero keeps the module default of retrying until the timeout; one disables retries. Each retry kills what the previous attempt left running, then re-runs the whole command.keep_descendants_alive?optionalboolOn every kill this call issues (timeout, retry sweep, failure cleanup), signal only the command itself and leave processes it spawned running, including runs it detached into their own sessions. By default a kill takes the command’s whole process group when the image has setsid, otherwise only the tagged processes.resultkubernetes.ExecResultExecResult with exit_code, stdout, stderr, stdout_truncated, and stderr_truncated.export_daemonsets
kubernetes.export_daemonsets(namespace, label_selector?)Prepare a lazy JSON DaemonSetList File using the tenant’s single configured cluster. Example: f = kubernetes.export_daemonsets(“gpu-operator”); key = objectstore.upload_file(f, “diagnostics/collection”). Includes complete Pod templates. Follows all Kubernetes pages inside the consuming activity. Expired continuation tokens or inconsistent resource versions fail the consumer; retry collection. Requires list on daemonsets in the namespace when consumed. Only a selection reference enters Temporal history; resource contents are read when a File consumer opens it. No content redaction or export byte ceiling. Resource contents can include literal environment values, arguments and annotations. The File is not a snapshot until consumed: reopening can read changed or replacement resources. Upload promptly to a distinct collection prefix, then reuse the stored File for durable evidence.
namespacestringRequired namespace containing the DaemonSets.label_selector?optionalstringKubernetes label selector.filescriptrt.FileJSON File containing a complete DaemonSetList for the selection, including full Pod templates and status; size is unknown until consumed.export_events
kubernetes.export_events(namespace?, object_name?, object_kind?, object_uid?)Prepare a lazy JSON EventList File using the tenant’s single configured cluster. Example: f = kubernetes.export_events(object_kind=“Node”, object_uid=“node-instance-uid”); key = objectstore.upload_file(f, “diagnostics/collection”). Requires a namespace or object_uid; object name or kind alone is insufficient across namespaces. Object filters are combined. Follows all Kubernetes pages inside the consuming activity. Expired pages or inconsistent resource versions fail the consumer; retry collection. Requires list on events in the selected scope. Expired events cannot be recovered. Only a selection reference enters Temporal history; resource contents are read when a File consumer opens it. No content redaction or export byte ceiling. Resource contents can include literal environment values, arguments and annotations. The File is not a snapshot until consumed: reopening can read changed or replacement resources. Upload promptly to a distinct collection prefix, then reuse the stored File for durable evidence.
namespace?optionalstringNamespace; empty requires object_uid and includes matching events across namespaces.object_name?optionalstringFilter by involvedObject.name.object_kind?optionalstringFilter by involvedObject.kind, such as Node or Pod.object_uid?optionalstringFilter by involvedObject.uid to distinguish resource instances. Required when namespace is empty.filescriptrt.FileJSON File containing a complete EventList for the selection; size is unknown until consumed. No event bodies return to Starlark.export_node
kubernetes.export_node(cluster, node)Prepare a lazy JSON File containing one complete Node resource. Example: f = kubernetes.export_node(“cluster-context”, “worker-1”); key = objectstore.upload_file(f, “diagnostics/collection”). Requires get on nodes when consumed. Only a selection reference enters Temporal history; resource contents are read when a File consumer opens it. No content redaction or export byte ceiling. Resource contents can include literal environment values, arguments and annotations. The File is not a snapshot until consumed: reopening can read changed or replacement resources. Upload promptly to a distinct collection prefix, then reuse the stored File for durable evidence.
clusterstringConfigured Kubernetes cluster context.nodestringNode name selecting the live resource at consumption time.filescriptrt.FileJSON File containing the complete Node, including metadata, spec and status; size is unknown until consumed.export_pod
kubernetes.export_pod(pod)Prepare a lazy JSON File containing one complete Pod resource. Example: f = kubernetes.export_pod(kubernetes.tenant_pod_handle(“default”, “worker-pod”)); key = objectstore.upload_file(f, “diagnostics/collection”). Requires get on pods when consumed. Only a selection reference enters Temporal history; resource contents are read when a File consumer opens it. No content redaction or export byte ceiling. Resource contents can include literal environment values, arguments and annotations. The File is not a snapshot until consumed: reopening can read changed or replacement resources. Upload promptly to a distinct collection prefix, then reuse the stored File for durable evidence.
podkubernetes.PodHandlePodHandle selecting the pod.filescriptrt.FileJSON File containing the complete Pod, including metadata, spec and status; size is unknown until consumed.export_pods
kubernetes.export_pods(namespace?, node?, label_selector?)Prepare a lazy JSON PodList File using the tenant’s single configured cluster. Example: f = kubernetes.export_pods(node=“worker-1”); key = objectstore.upload_file(f, “diagnostics/collection”). Requires a namespace or node; a label selector alone is insufficient. Follows all Kubernetes pages inside the consuming activity; no resource bodies or continuation tokens return to Starlark. Expired continuation tokens or inconsistent resource versions fail the consumer; retry collection. Requires list on pods in the selected scope when consumed. Only a selection reference enters Temporal history; resource contents are read when a File consumer opens it. No content redaction or export byte ceiling. Resource contents can include literal environment values, arguments and annotations. The File is not a snapshot until consumed: reopening can read changed or replacement resources. Upload promptly to a distinct collection prefix, then reuse the stored File for durable evidence.
namespace?optionalstringNamespace; empty requires node and includes matching Pods across namespaces.node?optionalstringOnly Pods scheduled on this node; empty requires namespace and includes all nodes in that namespace.label_selector?optionalstringKubernetes label selector.filescriptrt.FileJSON File containing a complete PodList for the selection, including full Pod specs and status; size is unknown until consumed.get_cr
kubernetes.get_cr(cluster, cr_name, gvr, namespace?, expected_uid?)Fetch a CR and return it as a dict. Can only be called from within a Temporal workflow.
clusterstringThe name of the cluster.cr_namestringThe name of the CR to read.gvrkubernetes.GVRThe GroupVersionResource of the CR (created via k8s.gvr()).namespace?optionalstringThe CR namespace. Empty for cluster-scoped CRs.expected_uid?optionalstringThe request UID from the callback. If supplied, a different UID fails the read.crdict[string:any]The CR as a dict (e.g. cr[‘spec’][‘action’], cr[‘status’][‘phase’]).get_node
kubernetes.get_node(cluster, node)Get a single node by name, including its provider ID, boot ID, and NodeConditions. Can only be called from within a Temporal workflow.
clusterstringThe name of the cluster.nodestringThe name of the node.nodekubernetes.NodeInfoNodeInfo with name, cluster, provider ID, boot ID, taints, unschedulable status, and conditions.get_pod_logs
kubernetes.get_pod_logs(pod, container, previous?, since_time?, tail_lines?, max_bytes?, timestamps?)Prepare a lazy File for current or previous container logs. Example: f = kubernetes.get_pod_logs(kubernetes.tenant_pod_handle(“default”, “worker-pod”), “worker”); key = objectstore.upload_file(f, “diagnostics/run-unique-id”). Only reference metadata enters history; bytes stream when a File consumer opens it. Requires get on pods and pods/log. No content redaction. The observed Pod/container identity is checked at open time; retained logs can still grow or rotate. Upload promptly for a durable snapshot and use a distinct workflow/collection destination prefix for each snapshot.
podkubernetes.PodHandlePodHandle selecting the pod.containerstringExplicit regular, init or ephemeral container name.previous?optionalboolSelect the previous terminated container instance; default false.since_time?optionalstringRFC3339 lower time bound; empty selects all retained history within the other filters.tail_lines?optionalintPositive line limit; zero leaves the line count unbounded.max_bytes?optionalintOptional byte limit; zero (the default) adds no byte limit. A positive value fails the consumer read if exceeded instead of silently truncating.timestamps?optionalboolInclude Kubernetes log timestamps; default true.filescriptrt.FileFile with unknown size until consumed. Pass to objectstore.upload_file or a File-based attachment API; no log text is returned to Starlark. Native retention and explicit time/line filters can omit history.gvr
kubernetes.gvr(group, version, resource)Create a GroupVersionResource for specifying a Kubernetes CR type.
groupstringThe API group (e.g., ‘workflow.example.com’).versionstringThe API version (e.g., ‘v1alpha1’).resourcestringThe resource name in plural form (e.g., ‘nodeactions’).gvrkubernetes.GVRThe GVR instance.list_crs
kubernetes.list_crs(cluster, gvr)List all custom resources of a given type in a cluster. Can only be called from within a Temporal workflow.
clusterstringThe name of the cluster.gvrkubernetes.GVRThe GroupVersionResource of the CR type (created via k8s.gvr()).crskubernetes.CRListList of CRDetail objects with name, node, status fields, and completion time.list_idle_blocker_pods
kubernetes.list_idle_blocker_pods(cluster, node, namespace?)List idle-blocker pods on a specific node.
clusterstringThe name of the cluster.nodestringThe name of the node.namespace?optionalstringThe namespace to list pods in. Defaults to the stored intent namespace or tenant idle_blocker_namespace setting.podskubernetes.SessionPodListSessionPodList with idle-blocker pod details.list_node_details
kubernetes.list_node_details(label_keys?, label_selector?, taint_key?, page_size?)List the tenant’s nodes with the requested label values, plus taints, cordon state, readiness, and GPU counts. Unlike list_nodes, which returns identity fields and full NodeConditions for an explicit cluster, this returns a lean NodeDetail sized for cluster-wide reads, and the cluster is the tenant’s single configured cluster, never a parameter. Can only be called from within a Temporal workflow.
label_keys?optionallist[string]Projection only: label keys whose values to return (e.g. [“screening.example.com/role”]). Never changes which nodes return. Keys absent on a node are omitted; labels nobody asked for are never returned, keeping the payload small.label_selector?optionalstringA Kubernetes label selector, filtered on the API server. Empty returns all nodes. Composes with taint_key; its keys need not appear in label_keys.taint_key?optionalstringOnly return nodes carrying a taint with this key, filtered in the activity because the API server cannot select on taints. Composes with label_selector.page_size?optionalintNodes per API page. Must be positive. Defaults to 500; values above 2000 are capped at 2000.nodeskubernetes.NodeDetailListNodeDetailList with the resolved cluster and a list of NodeDetail objects.list_node_pods
kubernetes.list_node_pods(cluster, namespace, node)List all Remediation Orchestrator session pods on a specific node.
clusterstringThe name of the cluster.namespacestringThe namespace to list pods in.nodestringThe name of the node.podskubernetes.SessionPodListSessionPodList with a list of SessionPodDetail objects.list_nodes
kubernetes.list_nodes(cluster)List all nodes in a cluster, including provider IDs, boot IDs, and NodeConditions. For a lean cluster-wide read with label values, taint details, readiness, and GPU counts, use list_node_details instead. Can only be called from within a Temporal workflow.
clusterstringThe name of the cluster.nodeskubernetes.NodeListList of NodeInfo objects with name, cluster, provider ID, boot ID, taints, unschedulable status, and conditions.list_pods
kubernetes.list_pods(namespace, label_selector?, node?, limit?)List pods in a namespace, optionally filtered by a label selector and a node. The cluster is the tenant’s single configured cluster, never a parameter. Labels are not unique in Kubernetes, so callers select the pod they want from the result (e.g. via pod_handle).
namespacestringThe namespace to list pods in.label_selector?optionalstringA Kubernetes label selector (e.g. “app=veracity,role=management”).node?optionalstringOnly list pods scheduled on this node.limit?optionalintMaximum number of pods to return. Must be positive. Defaults to 500.podskubernetes.PodListPodList with a list of PodDetail objects.mark_cr_complete
kubernetes.mark_cr_complete(cluster, cr_name, gvr, expected_uid?)Mark a CR as complete by setting completionTime on it. Can only be called from within a Temporal workflow.
clusterstringThe name of the cluster.cr_namestringThe name of the CR to mark complete.gvrkubernetes.GVRThe GroupVersionResource of the CR (created via k8s.gvr()).expected_uid?optionalstringThe original CR UID captured when selecting the request. When supplied, mutations reject a different UID; omission retains legacy name-based behavior.on_cordon
kubernetes.on_cordon(name, workflow, cluster, args?)Trigger a workflow when a node is cordoned. Cannot be called from within a Temporal workflow.
namestringA name for this on_cordon entrypoint. This will be used in the workflow ID.workflowworkflows.WorkflowThe workflow object.clusterstringThe name of the cluster.args?optionaldict[string:any]The arguments to pass to the workflow.on_cr_created
kubernetes.on_cr_created(name, workflow, cluster, gvr, args?)Trigger one workflow per CR. Receives cr_name, node_name, cluster_name, gvr_group, gvr_version, and gvr_resource. Document cr_namespace and cr_uid in the callback Args or Kwargs to receive request identity. Document node_names (list[string]) to handle requests with multiple nodes; node_name is empty for those requests. Cannot be called from within a Temporal workflow.
namestringA name for this on_cr_created entrypoint. This will be used in the workflow ID.workflowworkflows.WorkflowThe workflow object. Callbacks that declare cr_uid receive the original request UID and can pass it as expected_uid to CR mutation APIs.clusterstringThe name of the cluster.gvrkubernetes.GVRThe GroupVersionResource of the CR to watch (created via k8s.gvr()).args?optionaldict[string:any]Additional arguments to pass to the workflow.on_external_remediation
kubernetes.on_external_remediation(name, workflow, cluster, gvr, args?)Trigger a workflow when an NVSentinel ExternalRemediationRequest is ready for external remediation. Cannot be called from within a Temporal workflow.
namestringA name for this on_external_remediation entrypoint. This will be used in the workflow ID.workflowworkflows.WorkflowThe workflow object. Callbacks that declare cr_uid receive the original request UID and can pass it as expected_uid to CR mutation APIs.clusterstringThe name of the cluster.gvrkubernetes.GVRThe GroupVersionResource of the ExternalRemediationRequest CR (created via kubernetes.gvr() or kubernetes.external_remediation_gvr).args?optionaldict[string:any]Additional arguments to pass to the workflow.on_external_remediation_all_configured_clusters
kubernetes.on_external_remediation_all_configured_clusters(name, workflow, gvr, args?)Trigger a workflow for ExternalRemediationRequests from every cluster configured for the Kubernetes module. Cannot be called from within a Temporal workflow.
namestringA name for this entrypoint. This will be used in the workflow ID.workflowworkflows.WorkflowThe workflow object. Callbacks that declare cr_uid receive the original request UID and can pass it as expected_uid to CR mutation APIs.gvrkubernetes.GVRThe GroupVersionResource of the ExternalRemediationRequest CR (created via kubernetes.gvr() or kubernetes.external_remediation_gvr).args?optionaldict[string:any]Additional arguments to pass to the workflow.on_taint
kubernetes.on_taint(name, workflow, cluster, taint_key?, args?)Trigger a workflow when a node has a taint. Cannot be called from within a Temporal workflow.
namestringA name for this on_taint entrypoint. This will be used in the workflow ID.workflowworkflows.WorkflowThe workflow object.clusterstringThe name of the cluster.taint_key?optionalstringThe key of the taint to trigger on.args?optionaldict[string:any]The arguments to pass to the workflow.pod_handle
kubernetes.pod_handle(cluster, namespace, pod_name)Create a PodHandle for an existing pod. Use this to exec or delete pods not created by create_pod.
clusterstringThe name of the cluster.namespacestringThe namespace of the pod.pod_namestringThe name of the pod.podkubernetes.PodHandlePodHandle for use with exec, delete_pod, and describe_pod.remove_node_label
kubernetes.remove_node_label(cluster, node, key)Remove a label from a Kubernetes Node. Can only be called from within a Temporal workflow.
clusterstringThe name of the cluster.nodestringThe name of the node.keystringThe label key to remove.remove_node_status_condition
kubernetes.remove_node_status_condition(cluster, node, condition_type)Remove a Kubernetes Node status condition by type. Can only be called from within a Temporal workflow.
clusterstringThe name of the cluster.nodestringThe name of the node.condition_typestringThe Node condition type to remove.remove_taint
kubernetes.remove_taint(cluster, node, key)Removes a taint from a node. Can only be called from within a Temporal workflow.
clusterstringThe name of the cluster.nodestringThe name of the node.keystringThe key of the taint to remove.run_pod
kubernetes.run_pod(cluster, namespace, node, command, timeout?, image?, args?, env?)Run a command in an ephemeral pod on a specific node. Can only be called from within a Temporal workflow.
clusterstringThe name of the cluster.namespacestringThe namespace for the pod.nodestringThe name of the node to run on.commandstringThe command to execute.timeout?optionalstringTimeout for the command execution as a duration string (e.g. ‘5m’, ‘1h’). Defaults to 5m.image?optionalstringThe container image to use. Defaults to busybox:latest.args?optionallist[string]Literal arguments to append to the command; shell syntax belongs in command.env?optionaldict[string:string]Environment variables as a dict.resultkubernetes.RunPodResultRunPodResult with exit_code, logs, and termination_message.set_cr_condition
kubernetes.set_cr_condition(cluster, cr_name, gvr, type, status, reason, message, expected_uid?, namespace?, additional_conditions?, status_fields?)Set Kubernetes status conditions and optional status fields in one update. Upserts conditions by type. Can only be called from within a Temporal workflow.
clusterstringThe name of the cluster.cr_namestringThe name of the CR to update.gvrkubernetes.GVRThe GroupVersionResource of the CR (created via k8s.gvr()).typestringThe condition type (e.g. ‘ActionComplete’).statusstringThe condition status: ‘True’, ‘False’, or ‘Unknown’.reasonstringMachine-readable reason (e.g. ‘ActionFinished’).messagestringHuman-readable message describing the condition.expected_uid?optionalstringThe original CR UID captured when selecting the request. Required for namespaced CRs. Cluster-scoped CRs retain legacy name-based behavior when omitted.namespace?optionalstringThe CR namespace. Empty for cluster-scoped CRs.additional_conditions?optionallist[dict[string:any]]Additional conditions to upsert in the same update. Each dict supplies type, status, reason, and message. Each condition type must be distinct.status_fields?optionaldict[string:any]Top-level status fields and their JSON values. Use the condition arguments for status.conditions.set_node_label
kubernetes.set_node_label(cluster, node, key, value, expected_uid?, expected_value?)Add or update a label on a Kubernetes Node. Pass both expected_uid and expected_value to require the same node UID and prior label value in the update. On a retry, the expected node UID and desired label value count as success. Can only be called from within a Temporal workflow.
clusterstringThe name of the cluster.nodestringThe name of the node.keystringThe label key.valuestringThe label value.expected_uid?optionalstringThe expected Kubernetes Node UID. Requires expected_value.expected_value?optionalanyThe expected value of the existing label. An empty string matches an existing empty value. Requires expected_uid.set_node_status_condition
kubernetes.set_node_status_condition(cluster, node, condition_type, status, reason?, message?)Add or update a Kubernetes Node status condition. Can only be called from within a Temporal workflow.
clusterstringThe name of the cluster.nodestringThe name of the node.condition_typestringThe Node condition type.statusstringThe condition status: True, False, or Unknown.reason?optionalstringThe machine-readable reason for the condition.message?optionalstringThe human-readable condition message.tenant_pod_handle
kubernetes.tenant_pod_handle(namespace, pod_name)Create a PodHandle for an existing pod. The cluster is the tenant’s single configured cluster, never a parameter. Use pod_handle to name a cluster explicitly. Example: pod = kubernetes.tenant_pod_handle(“veracity”, “veracity-home-0”); result = kubernetes.exec_in_pod(pod, “nvidia-smi”).
namespacestringThe namespace of the pod.pod_namestringThe name of the pod.podkubernetes.PodHandlePodHandle for use with exec, delete_pod, and describe_pod.uncordon
kubernetes.uncordon(cluster, node)Uncordon a node. Can only be called from within a Temporal workflow.
clusterstringThe name of the cluster.nodestringThe name of the node.update_cr_metadata
kubernetes.update_cr_metadata(cluster, cr_name, gvr, add_finalizers?, remove_finalizers?, labels?, annotations?, expected_uid?)Update metadata on a CR (finalizers, labels, annotations). Can only be called from within a Temporal workflow.
clusterstringThe name of the cluster.cr_namestringThe name of the CR.gvrkubernetes.GVRThe GroupVersionResource of the CR (created via k8s.gvr()).add_finalizers?optionallist[string]List of finalizers to add.remove_finalizers?optionallist[string]List of finalizers to remove.labels?optionaldict[string:string]Labels to add or update.annotations?optionaldict[string:string]Annotations to add or update.expected_uid?optionalstringThe original CR UID captured when selecting the request. When supplied, mutations reject a different UID; omission retains legacy name-based behavior.update_cr_status
kubernetes.update_cr_status(cluster, cr_name, gvr, field, value, expected_uid?)Update a field in a CR’s status subresource. Can only be called from within a Temporal workflow.
clusterstringThe name of the cluster.cr_namestringThe name of the CR to update.gvrkubernetes.GVRThe GroupVersionResource of the CR (created via k8s.gvr()).fieldstringThe status field name to update (e.g. ‘phase’, ‘trackingId’).valuestringThe string value to set.expected_uid?optionalstringThe original CR UID captured when selecting the request. When supplied, mutations reject a different UID; omission retains legacy name-based behavior.wait_for_cr_change
kubernetes.wait_for_cr_change(cluster, cr_name, gvr, field, value, timeout?)Wait for a CR status field to reach a specific value. Blocks until the condition is met. Can only be called from within a Temporal workflow.
clusterstringThe name of the cluster.cr_namestringThe name of the CR to watch.gvrkubernetes.GVRThe GroupVersionResource of the CR (created via k8s.gvr()).fieldstringThe status field to watch (e.g. ‘phase’).valuestringThe value to wait for (e.g. ‘READY’).timeout?optionalstringTimeout as a duration string (e.g. ‘168h’ for 7 days). Defaults to 7 days.