gcluster job

NAME

gcluster job - manages jobs on the cluster.

SYNOPSIS

gcluster job COMMAND [FLAGS]

DESCRIPTION

The gcluster job command group lets you submit, cancel, list, and inspect workloads on Google Kubernetes Engine (GKE) and Kubernetes clusters.

PERSISTENT FLAGS

These flags are available to all commands:

  • -c, --cluster CLUSTER_NAME: The name of the GKE cluster or Kubernetes kubeconfig context. Optional in Kubernetes mode when the current-context field is set.
  • -l, --location LOCATION: The location, either a region or a zone, of the GKE cluster (GKE only).
  • -p, --project PROJECT_ID: The Google Cloud project ID (GKE only).
  • --gke-namespace NAMESPACE: The target Kubernetes namespace for the operation. If you omit this flag, then the gcluster CLI detects the namespace automatically.
  • --skip-prereqs: Skips local environment prerequisite checks, such as kubectl and gcloud checks, and container registry authentication for Crane builds.

ENVIRONMENT VARIABLES

You can customize gcluster job command behavior with the following environment variables:

  • GCLUSTER_AIR_GAPPED: Set to true (or 1, yes, on) in disconnected environments to skip live API server version probes, outbound GitHub add-on installations, Cloud Storage pre-flight checks, and CLI telemetry uploads for the current command.
  • GCLUSTER_DISABLE_JOBSET: Set to 1 (or true, yes, on) to bypass the JobSet API across gcluster job commands and submit single-slice, non-Pathways workloads as a standalone batch/v1 Indexed Job and headless Service.
  • GCLUSTER_DISABLE_KUEUE: Set to 1 (or true, yes, on) to skip Kueue installation and queueing and omit the kueue.x-k8s.io/queue-name label.
  • GCLUSTER_IMAGE_REPO: The destination repository for Crane --build-context builds. Set an Artifact Registry repository name or a full REGISTRY_HOST/REPOSITORY Open Container Initiative (OCI) prefix.
  • GCLUSTER_INSECURE_REGISTRY: Set to true or 1 to allow plain HTTP or self-signed Transport Layer Security (TLS) for custom or local OCI registries during --build-context builds. Ignored for Artifact Registry and public cloud registries.
  • GCLUSTER_ORCHESTRATOR: Set to gke or k8s to override automatic kubeconfig orchestrator detection.
  • GCLUSTER_REFRESH_CREDENTIALS: Set to 1 to run the gcloud container clusters get-credentials command before each command instead of reusing a verified kubeconfig context.
  • GCLUSTER_TELEMETRY_IMAGE: The default container image for the built-in ML Diagnostics collector sidecar when the --enable-ml-diagnostics flag is set without the --ml-diagnostics-image flag.

COMMANDS

COMMAND is one of the following:

cancel
Cancels a job in the cluster.
config
Manages configuration for the gcluster job command group.
gke-template-extract
Extracts all default GKE templates to a local directory.
inspect
Inspects cluster health and workload status.
list
Lists workloads in the cluster.
logs
Fetches logs for a job in the cluster.
submit
Submits a workload to a cluster. On GKE clusters, Cluster Toolkit deploys workloads as Kubernetes JobSet resources integrated with Kueue, or falls back to a standalone batch/v1 Indexed Job when the JobSet API isn't available or is disabled.

EXAMPLES

To submit a workload named train-job to a cluster:

gcluster job submit \
    --project=my-project \
    --cluster=my-cluster \
    --location=us-central1-a \
    --name=train-job \
    --compute-type=n2-standard-32 \
    --image=us-docker.pkg.dev/my-project/my-repo/training:v1 \
    --command="python3 train.py"

To list all running jobs in a cluster:

gcluster job list \
    --project=my-project \
    --cluster=my-cluster \
    --location=us-central1-a \
    --status=Running

To stream the logs for a specific job:

gcluster job logs train-job \
    --project=my-project \
    --cluster=my-cluster \
    --location=us-central1-a \
    --follow

To cancel a running job:

gcluster job cancel train-job \
    --project=my-project \
    --cluster=my-cluster \
    --location=us-central1-a

To configure default project and cluster settings so that you don't need to pass them on each command:

gcluster job config set project my-project
gcluster job config set cluster my-cluster
gcluster job config set location us-central1-a