# MPI Source: https://docs.trainy.ai/MPI Example task yamls for MPI ## Prerequisites #### Config.yaml (`~/.konduktor/config.yaml`) ``` ssh: enable: true ``` #### Current Working Directory ``` $ ls task.yaml ``` #### Launching ``` $ konduktor launch task.yaml ``` ## Task.yaml ``` name: mpirun-hostname num_nodes: 2 resources: cpus: 1 memory: 2 image_id: ubuntu labels: kueue.x-k8s.io/queue-name: user-queue maxRunDurationSeconds: "3200" run: | echo "Starting workload container on for ${NUM_NODES} benchmark" # Install ping apt update -y apt install -y iputils-ping # optionally install this if your container already builds this apt install -y openmpi-bin libopenmpi-dev # For every worker, wait till online and add to hostfile for HOST in $(echo "${NODE_HOST_IPS}" | sed "s/,/ /g"); do until ssh -p 2222 -i ~/.ssh/konduktor-key -o StrictHostKeyChecking=no ${HOST} -- 'which orted'; do echo Waiting for ${HOST}... sleep 10 done echo "${HOST} port=2222 slots=8" | tee -a /tmp/hostfile; done cat /tmp/hostfile # Launch from head node if [[ "${RANK}" -eq "0" ]]; then mpirun -np $(("$NUM_NODES" * 8)) \ --hostfile /tmp/hostfile \ -mca plm_rsh_no_tree_spawn 1 \ --mca orte_keep_fqdn_hostnames 1 \ --mca btl self,tcp \ --mca btl_tcp_if_include eth0 \ --allow-run-as-root \ --bind-to none \ --mca orte_base_help_aggregate 0 \ --mca plm_rsh_agent "ssh -q -o LogLevel=ERROR -o StrictHostKeyChecking=no -p 2222 -i ~/.ssh/konduktor-key -o UserKnownHostsFile=/dev/null" \ hostname else while ping -c 1 ${MASTER_ADDR}; do sleep 5 done fi exit 0 ``` # Validate API key Source: https://docs.trainy.ai/api-reference/auth/validate-api-key /pluto/api-reference/openapi.json get /api/runs/auth/validate Validates the API key and returns organization information. Used by MCP clients to verify credentials. # List all projects Source: https://docs.trainy.ai/api-reference/projects/list-all-projects /pluto/api-reference/openapi.json get /api/runs/projects Returns all projects in the organization associated with the API key. # Add log names to a run Source: https://docs.trainy.ai/api-reference/runs/add-log-names-to-a-run /pluto/api-reference/openapi.json post /api/runs/logName/add Adds new log names (metrics, console logs, etc.) to an existing run. # Compare metrics across multiple runs Source: https://docs.trainy.ai/api-reference/runs/compare-metrics-across-multiple-runs /pluto/api-reference/openapi.json get /api/runs/compare Returns per-run aggregates (count, min, max, mean, final) for a single metric across multiple runs, read from the pre-computed summaries table. Raw, no editorializing — interpretation is the caller's job. # Create a new run Source: https://docs.trainy.ai/api-reference/runs/create-a-new-run /pluto/api-reference/openapi.json post /api/runs/create Creates a new run in the specified project. If the project doesn't exist, it will be created. If externalId is provided and a run with that ID already exists, the existing run is returned (Neptune-style resume for multi-node distributed training). # Create model graph Source: https://docs.trainy.ai/api-reference/runs/create-model-graph /pluto/api-reference/openapi.json post /api/runs/modelGraph/create Creates a model graph visualization for a run, including nodes and edges. # Get files and artifacts from a run Source: https://docs.trainy.ai/api-reference/runs/get-files-and-artifacts-from-a-run /pluto/api-reference/openapi.json get /api/runs/files Returns file metadata with presigned URLs for downloading. URLs are valid for 5 days. # Get full run details Source: https://docs.trainy.ai/api-reference/runs/get-full-run-details /pluto/api-reference/openapi.json get /api/runs/details/{runId} Returns complete run information including config, metadata, tags, status, and available log names. # Get run by ID Source: https://docs.trainy.ai/api-reference/runs/get-run-by-id /pluto/api-reference/openapi.json get /api/runs/{runId} Decodes a SQID-encoded run ID and returns the numeric ID. # Get run details by display ID Source: https://docs.trainy.ai/api-reference/runs/get-run-details-by-display-id /pluto/api-reference/openapi.json get /api/runs/details/by-display-id/{displayId} Resolves a human-readable display ID (e.g., 'MMP-1') to a run and returns its details. # Get statistics for a run's metrics Source: https://docs.trainy.ai/api-reference/runs/get-statistics-for-a-runs-metrics /pluto/api-reference/openapi.json get /api/runs/statistics Returns per-metric aggregates (count, min, max, mean, stddev, last) read from the pre-computed summaries table. Raw, no editorializing — interpretation is the caller's job. # List distinct metric names in a project Source: https://docs.trainy.ai/api-reference/runs/list-distinct-metric-names-in-a-project /pluto/api-reference/openapi.json get /api/runs/metric-names Returns distinct metric names from the pre-computed metric summaries table. Useful for discovering available metrics before querying leaderboard or statistics. Optionally filter by a search substring or specific run IDs. # List runs with optional search and tag filtering Source: https://docs.trainy.ai/api-reference/runs/list-runs-with-optional-search-and-tag-filtering /pluto/api-reference/openapi.json get /api/runs/list Lists runs in a project with optional search using ILIKE substring matching. Supports tag filtering with OR logic (returns runs with ANY of the specified tags). # Query console logs from a run Source: https://docs.trainy.ai/api-reference/runs/query-console-logs-from-a-run /pluto/api-reference/openapi.json get /api/runs/logs Returns console logs (stdout/stderr) from ClickHouse. Supports filtering by log type and pagination. # Query metrics from a run Source: https://docs.trainy.ai/api-reference/runs/query-metrics-from-a-run /pluto/api-reference/openapi.json get /api/runs/metrics Returns time-series metrics from ClickHouse. Supports filtering by metric name, group, and step range. Uses reservoir sampling to limit data points. # Rank runs by a metric Source: https://docs.trainy.ai/api-reference/runs/rank-runs-by-a-metric /pluto/api-reference/openapi.json get /api/runs/leaderboard Returns runs ranked by a metric aggregation (MIN, MAX, AVG, LAST, VARIANCE) using pre-computed metric summaries. Much faster than comparing individual runs. Useful for finding the best runs in a project by loss, accuracy, or any other metric. # Resume an existing run Source: https://docs.trainy.ai/api-reference/runs/resume-an-existing-run /pluto/api-reference/openapi.json post /api/runs/resume Resumes an existing run, setting its status back to RUNNING. Returns the same response format as create. Use this when you want to log additional data (e.g., evaluation metrics) to a previously completed run. Provide exactly one of: runId (numeric), displayId (e.g., 'MMP-1'), or externalId (user-provided). # Update run config Source: https://docs.trainy.ai/api-reference/runs/update-run-config /pluto/api-reference/openapi.json post /api/runs/config/update Merges new configuration with existing run config. New keys override existing keys. # Update run notes Source: https://docs.trainy.ai/api-reference/runs/update-run-notes /pluto/api-reference/openapi.json post /api/runs/notes/update Updates the notes/description on a run. Set to null or empty string to clear. # Update run status Source: https://docs.trainy.ai/api-reference/runs/update-run-status /pluto/api-reference/openapi.json post /api/runs/status/update Updates the status of an existing run (e.g., RUNNING, COMPLETED, FAILED). # Update run tags Source: https://docs.trainy.ai/api-reference/runs/update-run-tags /pluto/api-reference/openapi.json post /api/runs/tags/update Replaces all tags on a run with the provided tags. # Authentication Source: https://docs.trainy.ai/authentication How to authenticate and connect to your Trainy managed k8s cluster. For Trainy Hub, use `konduktor login` and follow [Submit jobs through Trainy Hub](/hub-quickstart). Hub is in private preview. The methods below connect directly to a worker cluster after onboarding. * [Teleport](https://goteleport.com/) - via the `tsh` [CLI tool](https://goteleport.com/docs/connect-your-client/tsh/) - no additional cost * [Tailscale](https://tailscale.com/) - as a [shared device](https://tailscale.com/kb/1084/sharing) - recommended for users already using Tailscale # Teleport ## Identity Providers Teleport supports the following authentication providers * Google workspaces (Available) * Okta (Contact us for setup) * Github (Contact us for setup) * Auth0 (Contact us for setup) * and more! To begin, users should first have the `tsh` CLI installed on the machine that they want to access their cluster from by following [these instructions](https://goteleport.com/docs/connect-your-client/tsh/). ## Authentication example: Google To authenticate, use `tsh login` . The following example uses Google as the identity provider but the identity provider can be changed by simply changing the `--auth` flag value. Upon running `tsh login` a browser window should open prompting the user to complete the auth flow, as shown below. ``` tsh login \ --user=username@myawesome.co \ --proxy=trainy.teleport.sh:443 \ --auth=google ``` ![Google Auth Pn](https://mintcdn.com/trainy/C5m7tZRYfXXbd295/images/google-auth.png?fit=max\&auto=format\&n=C5m7tZRYfXXbd295\&q=85\&s=a7d17e5fb3f872a76e3beb527ac8b4f8) after completing the auth flow, you'll be presented with a page confirming if your authentication is successful. ![Teleport Auth Success Pn](https://mintcdn.com/trainy/C5m7tZRYfXXbd295/images/teleport-auth-success.png?fit=max\&auto=format\&n=C5m7tZRYfXXbd295\&q=85\&s=81c9819584dd48904e39ea9b2f538f05) Afterwards you can list which clusters you have access to. ``` $ tsh kube ls Kube Cluster Name Labels Selected ----------------- ---------------------------------------------------- -------- my-cluster tenant=myawesomeco ``` To configure a short-lived kubeconfig to start accessing one of your clusters ``` # get kubeconfig first $ tsh kube login my-cluster Logged into Kubernetes cluster "my-cluster". Try 'kubectl version' to test the connection. # then test connection $ kubectl get version Client Version: v1.31.6-dispatcher Kustomize Version: v5.4.2 Server Version: v1.33.1 ``` ## User isolation via namespace per user Every user after authentication will have full access to the namespace `default` and a dedicated namespace that only they have access to based on their username they used to authenticate. For example if authenticated as `myusername@myawesome.co` , you can perform administrative actions in the `trainy-myawesomeco-myusername` namespace. We recommend organizations that have strict isolation requirements especially regarding isolation of secrets/credentials between users manage jobs in their dedeicated namespace. ``` # create your dedicated namespace kubectl create ns trainy-myawesomeco-myusername # set your context kubectl config set-context --current --namespace=trainy-myawesomeco-myusername # start interacting with konduktor konduktor staus ``` > [!NOTE] > > Currently managing (listing/creating/deleting) has hard isolation between users with namespace isolation. That means another user cannot see another users job or delete it for them if the job is not launched in the shared access namespace `default` . We are working to create an admin role for creating/deleting jobs as well as increased user scopes for simply listing other users jobs to understand cluster capacity. # Tailscale Your Trainy admin will create a shareable link that users can use to access their Trainy cluster. Afterwards users can use `tailscale status` to check their cluster status, and `tailscale configure kubeconfig my-cluster` to connect to the cluster. ``` # check if cluster is available $ tailscale status 100.11.111.11 my-macbook-air-1 my-macbook-air-1.taila1111c.ts.net macOS - 100.11.111.121 my-cluster tagged-devices linux - # get credentials to connect to cluster $ tailscale configure kubeconfig my-cluster # test connection $ kubectl version Client Version: v1.31.6-dispatcher Kustomize Version: v5.4.2 Server Version: v1.33.1 ``` # CLI Reference Source: https://docs.trainy.ai/cli-reference Reference for the Konduktor CLI > [!TIP] > > **Using an AI coding assistant?** Install the [Konduktor Skills](https://github.com/Trainy-ai/konduktor-skills) plugin (`npx skills add Trainy-ai/konduktor-skills`) to let your AI construct CLI commands for you — run `/konduktor-cli` to get started. ### `konduktor status` Shows list of all the jobs with optional filtering and pagination. **Usage** ```bash theme={null} Usage: konduktor status [OPTIONS] ``` **Options** * `--all-users, -u`\ Show all jobs, including those not owned by the current user. * `--limit, -l INTEGER`\ Maximum number of jobs to display (e.g., --limit 100) * `--verbose, -v` Show additional job details, including `DESTINATION`, the Kueue cluster identifier recorded for each job. The default table and Kubernetes permissions remain unchanged without this flag. * `--after TEXT`\ Show jobs created after this timestamp (e.g., --after "08/06/25 03:54PM", --after "08/06/25", --after "03:54PM") * `--before TEXT`\ Show jobs created before this timestamp (e.g., --before "08/06/25 03:54PM", --before "08/06/25", --before "03:54PM") For Hub jobs, run `konduktor --context status --verbose`. `DESTINATION` comes from the retained Kueue Workload for the exact JobSet UID. It is a Kueue cluster identifier, not a local kubeconfig context or a claim of current execution. `-` means no destination is recorded, `ambiguous` means more than one Workload matches the run, and `unavailable` means the Workloads could not be read. A warning explains an unavailable lookup; job status still appears. **Examples** ```bash theme={null} konduktor status --limit 10 konduktor status --before "08/06/25 03:53PM" konduktor status --all-users --limit 10 --after "08/06/25 03:53PM" ``` **Notes** * When using --before or --after timestamps, "08/06/25" is equivalent to "08/06/25 00:00". * "03:53PM" is equivalent to "03:53:00PM". * Timestamps shown in "konduktor status" are truncated and are in the local timezone. Example: "03:53:55PM" → "03:53PM" would show up in --after "03:53PM" but not in --before "03:53PM". ### `konduktor logs` Retrieve/tail the log of a job. **Usage** ```bash theme={null} Usage: konduktor logs [OPTIONS] JOB_ID ``` **Arguments** * `JOB_ID` **Options** * `--status`\ \[DEPRECATED] If specified, do not show logs but exit with a status code for the job's status: 0 for succeeded, or 1 for all other statuses. * `--follow, --no-follow`\ Follow the logs of a job. If --no-follow is specified, print the log so far and exit. (default: --follow) * `--num-lines, --num_lines, -n INTEGER`\ The number of lines to display from the end of the log file. Default is -1 (no limit). *(default: `-1`)* * `--node-rank, --node_rank, -N INTEGER`\ The node rank to tail logs from. *(default: `0`)* * `--start-offset, --start_offset TEXT`\ Choose how much time from now to look back in logs. Examples: 30s, 5m, 2h, 1d. Default is 1h. Note: currently only applies when streaming (default --follow). With --no-follow, all available logs are returned. *(default: `1h`)* Hub log reads use the OIDC-protected endpoint and include every worker cluster in your namespace. Cluster-local reads keep the Kubernetes service-proxy path. ### `konduktor exec` **Experimental.** This command may change before it stabilizes. Runs a command in the current Hub job's `konduktor-container`. Execution is disabled by default on the Hub and worker. The selected Hub context supplies the credential and default namespace. JobSet read permission and `create` on `pods/exec` in that namespace are required. **Usage** ```bash theme={null} konduktor --context exec [OPTIONS] JOB_ID -- COMMAND... ``` **Arguments** * `JOB_ID`: Full Hub job ID. * `COMMAND...`: Executable and arguments in the job container. Arguments pass directly to the executable without shell interpolation. **Options** * `--stdin, -i`: Forward standard input. Disabled by default. * `--tty, -t`: Allocate a terminal and forward standard input. Requires interactive standard input and output. Disabled by default. * `--namespace TEXT`: Hub tenant namespace. Defaults to the selected context's namespace. The command returns the remote process's exit code. Exactly one eligible running Pod is required. Worker, Pod, container, and distributed rank selection are not supported. **Examples** ```bash theme={null} konduktor --context "$HUB_CONTEXT" exec "$JOB_ID" -- hostname konduktor --context "$HUB_CONTEXT" exec "$JOB_ID" -- sh -c 'echo "$HOSTNAME"; pwd' printf 'hello\n' | konduktor --context "$HUB_CONTEXT" exec -i "$JOB_ID" -- cat ``` ### `konduktor shell` **Experimental.** This command may change before it stabilizes. Opens an interactive shell in the current Hub job. Uses the same context, credential, permissions, and requirement for one running Pod as `exec`. **Usage** ```bash theme={null} konduktor --context shell [OPTIONS] JOB_ID ``` **Arguments** * `JOB_ID`: Full Hub job ID. **Options** * `--shell TEXT`: Shell executable in the job container. Default: `/bin/bash`. * `--namespace TEXT`: Hub tenant namespace. Defaults to the selected context's namespace. The shell must exist in the job image. Standard input and output must be interactive terminals. The CLI forwards input and terminal resize updates, restores terminal settings when the session ends, and returns the shell's exit code. **Examples** ```bash theme={null} konduktor --context "$HUB_CONTEXT" shell "$JOB_ID" konduktor --context "$HUB_CONTEXT" shell "$JOB_ID" --shell /bin/sh ``` For prerequisites and connection errors, see [Run commands in a Hub job](/hub-job-shell). ### `konduktor launch` Launch a task. **Usage** ```bash theme={null} Usage: konduktor launch [OPTIONS] [ENTRYPOINT]... ``` **Arguments** * `ENTRYPOINT...` **Options** * `--dryrun`\ If True, do not actually run the job. * `--detach-run, -d`\ If True, as soon as a job is submitted, return from this call and do not stream execution logs. * `--name, -n TEXT`\ Task name. Overrides the "name" config in the YAML if both are supplied. * `--workdir DIRECTORY`\ If specified, sync this dir to the remote working directory, where the task will be invoked. Overrides the "workdir" config in the YAML if both are supplied. * `--cloud TEXT`\ The cloud to use. If specified, overrides the "resources.cloud" config. Passing "none" resets the config. \[defunct] currently only supports a single cloud * `--num-nodes INTEGER`\ Number of nodes to execute the task on. Overrides the "num\_nodes" config in the YAML if both are supplied. * `--max-restarts INTEGER`\ Maximum number of jobset restarts allowed. Overrides YAML.Overrides the "max\_restarts" config in the YAML if both are supplied. * `--completions INTEGER`\ Number of successful completions required. Overrides YAML.Overrides the "completions" config in the YAML if both are supplied. * `--cpus TEXT`\ Number of vCPUs each instance must have (e.g., `--cpus=4` (exactly 4) or `--cpus=4+` (at least 4)). This is used to automatically select the instance type. * `--memory TEXT`\ Amount of memory each instance must have in GB (e.g., `--memory=16` (exactly 16GB), `--memory=16+` (at least 16GB)) * `--disk-size INTEGER`\ OS disk size in GBs. * `--image-id TEXT`\ Custom image id for launching the instances. Passing "none" resets the config. * `--env-file DOTENV_VALUES`\ Path to a dotenv file with environment variables to set on the remote node. If any values from `--env-file` conflict with values set by `--env`, the `--env` value will be preferred. * `--env _PARSE_ENV_VAR`\ \\ Environment variable to set on the remote node. It can be specified multiple times: 1. `--env MY_ENV=1`: set `$MY_ENV` on the cluster to be 1. 2. `--env MY_ENV2=$HOME`: set `$MY_ENV2` on the cluster to be the same value of `$HOME` in the local environment where the CLI command is run. 3. `--env MY_ENV3`: set `$MY_ENV3` on the cluster to be the same value of `$MY_ENV3` in the local environment. * `--gpus TEXT`\ Type and number of GPUs to use. Example values: "V100:8", "V100" (short for a count of 1) If a new cluster is being launched by this command, this is the resources to provision. If an existing cluster is being reused, this is seen as the task demand, which must fit the cluster's total resources and is used for scheduling the task. Overrides the "accelerators" config in the YAML if both are supplied. Passing "none" resets the config. * `--yes, -y`\ Skip confirmation prompt. * `--skip-image-check, -s`\ Skip Docker image validation checks for faster startup. **Notes** * If ENTRYPOINT points to a valid YAML file, it is read in as the task specification. Otherwise, it is interpreted as a bash command. ### `konduktor down` Tear down job(s). **Usage** ```bash theme={null} Usage: konduktor down [OPTIONS] [JOBS]... ``` **Arguments** * `JOBS...` **Options** * `--all, -a`\ Tear down all jobs. * `--all-users, --all_users`\ Include other users for teardown * `--yes, -y`\ Skip confirmation prompt. **Examples** ```bash theme={null} # Tear down a specific job. konduktor down my_job # Tear down multiple jobs. konduktor down my_job1 my_job2 # Tear down all jobs matching a pattern. konduktor down "my_job-*" # Tear down all of this users jobs. konduktor down -a konduktor down --all # Tear down all jobs across all users konduktor down --all --all-users ``` **Notes** * If both JOB and `--all` are supplied, the latter takes precedence. * Tearing down a job will delete all associated containers (all billing stops), and any data on the containers disks will be lost. Accelerators (e.g., GPUs) that are part of the job will be deleted too. * Wildcard patterns are supported using \* characters. Ex: "test-*" matches all jobs starting with "test-", "*-gpu" matches all jobs ending with "-gpu". ### `konduktor stop` Suspend job(s) (manual/user-initiated). **Usage** ```bash theme={null} Usage: konduktor stop [OPTIONS] [JOBS]... ``` **Arguments** * `JOBS...` **Options** * `--all, -a`\ Suspend all jobs. * `--all-users, --all_users`\ Include other users for suspension * `--yes, -y`\ Skip confirmation prompt. **Examples** ```bash theme={null} # Suspend a specific job. konduktor stop my_job # Suspend multiple jobs. konduktor stop my_job1 my_job2 # Suspend all jobs matching a pattern. konduktor stop "my_job-*" # Suspend all of this users jobs. konduktor stop -a konduktor stop --all # Suspend all jobs across all users konduktor stop --all --all-users ``` **Notes** * If both JOB and `--all` are supplied, the latter takes precedence. * Suspending a job will pause execution and mark the job as SUSPENDED (by user). The job can be resumed later with `konduktor start`. * If a job is suspended by the system (e.g., due to queueing), it will show as SUSPENDED (by system). * Wildcard patterns are supported using \* characters. Ex: "test-*" matches all jobs starting with "test-", "*-gpu" matches all jobs ending with "-gpu". ### `konduktor start` Resume suspended job(s) (manual/user-initiated). **Usage** ```bash theme={null} Usage: konduktor start [OPTIONS] [JOBS]... ``` **Arguments** * `JOBS...` **Options** * `--all, -a`\ Resume all suspended jobs. * `--all-users, --all_users`\ Include other users for resumption * `--yes, -y`\ Skip confirmation prompt. **Examples** ```bash theme={null} # Resume a specific job. konduktor start my_job # Resume multiple jobs. konduktor start my_job1 my_job2 # Resume all jobs matching a pattern. konduktor start "my_job-*" # Resume all of this users suspended jobs. konduktor start -a konduktor start --all # Resume all suspended jobs across all users konduktor start --all --all-users ``` **Notes** * If both JOB and `--all` are supplied, the latter takes precedence. * Resuming a job will restart execution from where it was suspended. Only suspended jobs can be resumed. * This command works for both manually suspended jobs (SUSPENDED by user) and system-suspended jobs (SUSPENDED by system). * Wildcard patterns are supported using \* characters. Ex: "test-*" matches all jobs starting with "test-", "*-gpu" matches all jobs ending with "-gpu". ### `konduktor check` Check which clouds are available to use for storage with Konduktor **Usage** ```bash theme={null} Usage: konduktor check [OPTIONS] CLOUDS... ``` **Arguments** * `CLOUDS...` **Examples** ```bash theme={null} # Check only specific clouds - gs, s3. konduktor check gs konduktor check s3 ``` **Notes** * This checks storage credentials for a cloud supported by konduktor. If a cloud is detected to be inaccessible, the reason and correction steps will be shown. * If CLOUDS are specified, checks credentials for only those clouds. * The enabled clouds are cached and form the "search space" to be considered for each task. ## `konduktor secret` Manage secrets used in Konduktor. **Usage** ```bash theme={null} konduktor secret COMMAND ``` **Examples** ```bash theme={null} konduktor secret create --kind git-ssh --from-file ~/.ssh/id_rsa my-ssh-name konduktor secret create --kind env --inline FOO=bar my-env-name konduktor secret delete my-ssh-name konduktor secret list ``` ### `konduktor secret create` Create a new secret. **Usage** ```bash theme={null} Usage: konduktor secret create [OPTIONS] NAME ``` **Arguments** * `NAME` **Options** * `--kind CHOICE`\ Type of secret being created. More kinds coming soon. *(default: `default`)* * `--from-directory, --from_directory DIRECTORY`\ Path to a directory to store as a multi-file secret. * `--from-file, --from_file FILE`\ Path to a single file to store as a secret. * `--inline KEY=VALUE`\ Key=value pair to store as an env secret (only valid with --kind env). ### `konduktor secret delete` Delete a secret by name. **Usage** ```bash theme={null} Usage: konduktor secret delete [OPTIONS] NAME ``` **Arguments** * `NAME` ### `konduktor secret list` List secrets in the namespace. **Usage** ```bash theme={null} Usage: konduktor secret list [OPTIONS] ``` **Options** * `--all-users, --all_users, -u`\ Show all secrets, including those not owned by the current user. ## `konduktor serve` Manage deployment serving with Konduktor. **Usage** ```bash theme={null} konduktor serve COMMAND ``` **Examples** ```bash theme={null} konduktor serve launch my-deployment konduktor serve down my-deployment konduktor serve status ``` ### `konduktor serve launch` Launch a deployment to serve. **Usage** ```bash theme={null} Usage: konduktor serve launch [OPTIONS] [ENTRYPOINT]... ``` **Arguments** * `ENTRYPOINT...` **Options** * `--namespace TEXT`\ Hub namespace for native Dynamo serving (defaults to hub.namespace). * `--pool TEXT`\ Existing hub LocalQueue for native Dynamo serving (default: user-queue). * `--dryrun`\ If True, do not actually run the job. * `--detach-run, -d`\ If True, as soon as a job is submitted, return from this call and do not stream execution logs. * `--name, -n TEXT`\ Task name. Overrides the "name" config in the YAML if both are supplied. * `--workdir DIRECTORY`\ If specified, sync this dir to the remote working directory, where the task will be invoked. Overrides the "workdir" config in the YAML if both are supplied. * `--cloud TEXT`\ The cloud to use. If specified, overrides the "resources.cloud" config. Passing "none" resets the config. \[defunct] currently only supports a single cloud * `--num-nodes INTEGER`\ Number of nodes to execute the task on. Overrides the "num\_nodes" config in the YAML if both are supplied. * `--max-restarts INTEGER`\ Maximum number of jobset restarts allowed. Overrides YAML.Overrides the "max\_restarts" config in the YAML if both are supplied. * `--completions INTEGER`\ Number of successful completions required. Overrides YAML.Overrides the "completions" config in the YAML if both are supplied. * `--cpus TEXT`\ Number of vCPUs each instance must have (e.g., `--cpus=4` (exactly 4) or `--cpus=4+` (at least 4)). This is used to automatically select the instance type. * `--memory TEXT`\ Amount of memory each instance must have in GB (e.g., `--memory=16` (exactly 16GB), `--memory=16+` (at least 16GB)) * `--disk-size INTEGER`\ OS disk size in GBs. * `--image-id TEXT`\ Custom image id for launching the instances. Passing "none" resets the config. * `--env-file DOTENV_VALUES`\ Path to a dotenv file with environment variables to set on the remote node. If any values from `--env-file` conflict with values set by `--env`, the `--env` value will be preferred. * `--env _PARSE_ENV_VAR`\ \\ Environment variable to set on the remote node. It can be specified multiple times: 1. `--env MY_ENV=1`: set `$MY_ENV` on the cluster to be 1. 2. `--env MY_ENV2=$HOME`: set `$MY_ENV2` on the cluster to be the same value of `$HOME` in the local environment where the CLI command is run. 3. `--env MY_ENV3`: set `$MY_ENV3` on the cluster to be the same value of `$MY_ENV3` in the local environment. * `--gpus TEXT`\ Type and number of GPUs to use. Example values: "V100:8", "V100" (short for a count of 1) If a new cluster is being launched by this command, this is the resources to provision. If an existing cluster is being reused, this is seen as the task demand, which must fit the cluster's total resources and is used for scheduling the task. Overrides the "accelerators" config in the YAML if both are supplied. Passing "none" resets the config. * `--min-replicas INTEGER`\ Minimum number of replicas to run for the service. Overrides the "min\_replicas" field in the YAML if both are supplied. * `--max-replicas INTEGER`\ Maximum number of replicas to allow for the service. Overrides the "max\_replicas" field in the YAML if both are supplied. * `--ports INTEGER`\ The container port on which your service will listen for HTTP traffic. Overrides the "ports" field in the YAML if both are supplied. * `--probe TEXT`\ The HTTP path to use for health checks (liveness, readiness, and startup probes). Overrides the "probe" field in the YAML if both are supplied. The service should respond with HTTP 200 on this path when healthy. * `--yes, -y`\ Skip confirmation prompt. * `--skip-image-check, -s`\ Skip Docker image validation checks for faster startup. **Notes** * If ENTRYPOINT points to a valid YAML file, it is read in as the task specification. Otherwise, it is interpreted as a bash command. * Native DynamoGraphDeployment YAML is submitted through the hub and returns immediately after API acceptance; capacity admission is asynchronous. Use --namespace or hub.namespace; set component overrides in the graph itself. ### `konduktor serve down` Tear down deployments, or native Dynamo graphs with --hub. **Usage** ```bash theme={null} Usage: konduktor serve down [OPTIONS] [NAMES]... ``` **Arguments** * `NAMES...` **Options** * `--hub`\ Manage native Dynamo serving through the hub. * `--namespace TEXT`\ Hub namespace (defaults to hub.namespace). * `--all, -a`\ Tear down all deployments. * `--yes, -y`\ Skip confirmation prompt. **Examples** ```bash theme={null} konduktor serve down my-deployment konduktor serve down -a ``` ### `konduktor serve status` Show status of deployments launched via `konduktor serve launch`. **Usage** ```bash theme={null} Usage: konduktor serve status [OPTIONS] [NAME] ``` **Arguments** * `NAME` **Options** * `--hub`\ Read native Dynamo serving status from the hub. * `--namespace TEXT`\ Hub namespace (defaults to hub.namespace). * `--json`\ Output native serving status as JSON. * `--all-users, -u`\ Show all deployments, including those not owned by the current user. * `--direct, -d`\ Force display of direct IP endpoints instead of trainy.us endpoints. ### `konduktor serve logs` Read native Dynamo component logs through the authenticated hub. **Usage** ```bash theme={null} Usage: konduktor serve logs [OPTIONS] NAME ``` **Arguments** * `NAME` **Options** * `--hub`\ Read native Dynamo serving logs from the hub. * `--namespace TEXT`\ Hub namespace (defaults to hub.namespace). * `--component TEXT`\ Dynamo component to read (for example Decode). * `--follow, -f`\ Follow new log records. * `--tail INTEGER RANGE`\ Number of recent log records. *(default: `100`)* # Enroll a worker cluster Source: https://docs.trainy.ai/cluster-enrollment Connect a Kubernetes worker cluster to a Konduktor organization without interrupting workloads already running on it. Enrollment connects a Kubernetes cluster to the Konduktor Hub so the Hub can dispatch work, keep Kueue and JobSet at the organization's supported versions, and collect workload telemetry. The process has two parts: 1. An organization administrator creates a one-shot enrollment blob on the Hub. 2. A worker-cluster administrator passes that blob to the worker bootstrap. > [!WARNING] > > Enrollment crosses a trust boundary. Pass an explicit Hub or worker context > to every command; do not rely on whichever context is currently active. > Konduktor accepts `--context` and `--kubeconfig` before the subcommand. ## Prerequisites You need: * A Konduktor organization and tenant namespace created by Trainy * An accepted WorkOS invitation to your Konduktor organization and organization-admin access to that tenant namespace * The Google Cloud CLI and `gke-gcloud-auth-plugin` * `kubectl` * Helm v3.17.1 or newer * Cluster-admin access to the worker cluster * The `konduktor` CLI * Outbound HTTPS and WebSocket access from the worker to the Hub endpoints Set these variables before starting. Replace the example values with your worker context, assigned tenant namespace, and chosen worker name: ```bash theme={null} WORKER_CONTEXT=example-worker-us TENANT_NS=example-team WORKER=example-worker-us WORKLOAD_NAMESPACES=("$TENANT_NS") ``` The worker name must be unique inside the tenant namespace. Another organization may use the same name. `WORKLOAD_NAMESPACES` must match the namespace list configured on the Konduktor organization. Do not add unrelated worker-local namespaces: Konduktor does not manage their LocalQueues. ## Get scoped access to the Hub Sign in to the hosted Hub and select the tenant namespace: ```bash theme={null} konduktor login --namespace "$TENANT_NS" HUB_CONTEXT='' ``` Complete the WorkOS device approval in your browser. The CLI discovers your assigned namespaces, selects the WorkOS organization for `TENANT_NS`, and exchanges its access token for a short-lived Google Workforce credential. Google does not start another browser login. The CLI creates a Hub Kubernetes context and makes it current after successful setup. Your organization owner or Trainy must invite you and assign the tenant namespace before login can configure it. Enrollment also requires permission to create `BootstrapEnrollment` objects in that namespace. Signing in does not grant that permission by itself. Use the printed Hub context explicitly for the rest of this procedure. Each context records its own organization-specific credential source under `~/.konduktor/auth/`; another terminal can use the same kubeconfig without exporting `CLOUDSDK_CONFIG`. Keep the CLI installed in the Python environment used for login so the credential source can refresh your session. If that environment changes, run `konduktor login` again. If your contexts live in a non-default kubeconfig, pass its path before the login command and use the same path for later commands: ```bash theme={null} konduktor --kubeconfig /absolute/path/to/config login --namespace "$TENANT_NS" konduktor --kubeconfig /absolute/path/to/config \ --context "$HUB_CONTEXT" cluster list -n "$TENANT_NS" ``` Use `kubectl --kubeconfig /absolute/path/to/config` for the checks below if you selected a non-default file. Confirm that the federated identity can connect, has the required enrollment permission in the intended tenant, and cannot create cluster-scoped Organizations: ```bash theme={null} kubectl --context "$HUB_CONTEXT" cluster-info kubectl --context "$HUB_CONTEXT" \ -n "$TENANT_NS" \ auth can-i create bootstrapenrollments.trainy.ai kubectl --context "$HUB_CONTEXT" \ auth can-i create organizations.trainy.ai ``` The namespace-scoped check must print `yes`; the cluster-scoped Organization check must print `no`. These checks do not prove that your account lacks access to every other tenant. Ask your organization owner or Trainy to confirm your organization memberships if you need an access audit. ## Enroll a new cluster **1. Confirm both Kubernetes targets** Check the local tools, cluster endpoints, and required permissions before making changes: ```bash theme={null} gcloud --version gke-gcloud-auth-plugin --version kubectl version --client helm version --short kubectl --context "$HUB_CONTEXT" cluster-info kubectl --context "$HUB_CONTEXT" \ -n "$TENANT_NS" \ auth can-i create bootstrapenrollments.trainy.ai kubectl --context "$WORKER_CONTEXT" cluster-info kubectl --context "$WORKER_CONTEXT" auth can-i create namespaces ``` Both permission checks must print `yes`. Organization administrators do not need permission to create `Organization` objects. Confirm that Helm reports v3.17.1 or newer before creating the one-shot enrollment. **2. Create the one-shot bootstrap blob** Create the bootstrap file atomically inside a private temporary directory, and arrange for it to be removed if this shell exits early: ```bash theme={null} umask 077 BOOTSTRAP_DIR="$(mktemp -d "${TMPDIR:-/tmp}/konduktor-bootstrap.XXXXXX")" chmod 700 "$BOOTSTRAP_DIR" BOOTSTRAP_BLOB="$(mktemp "$BOOTSTRAP_DIR/bootstrap.XXXXXX.txt")" cleanup_bootstrap() { rm -f -- "$BOOTSTRAP_BLOB" rmdir -- "$BOOTSTRAP_DIR" 2>/dev/null || true } trap cleanup_bootstrap EXIT konduktor --context "$HUB_CONTEXT" cluster enroll "$WORKER" \ --ns "$TENANT_NS" \ > "$BOOTSTRAP_BLOB" chmod 600 "$BOOTSTRAP_BLOB" ``` The CLI discovers the Hub, tunnel, and observability endpoints automatically. Do not add `--org`, endpoint overrides, or a CA bundle for the hosted Hub. > [!WARNING] > > The generated blob contains a private signing key. Treat it as a secret, > transfer it through an approved secure channel, and remove it after the > enrollment succeeds. Bootstrap carries that key in its process arguments > while it runs. Generate and run it only from a trusted, single-user > administration host, not a shared bastion. **3. Bootstrap the worker** Reconfirm the worker context, then bootstrap using the blob: ```bash theme={null} kubectl --context "$WORKER_CONTEXT" cluster-info konduktor --context "$WORKER_CONTEXT" \ worker bootstrap "$(cat "$BOOTSTRAP_BLOB")" ``` Review the plan and approve it. Bootstrap installs the worker agent, tunnel credentials, log collector, metrics agent, and their supporting namespaces and RBAC. It preserves an existing shared VictoriaMetrics operator. **4. Wait for readiness** Check enrollment from the Hub: ```bash theme={null} konduktor --context "$HUB_CONTEXT" \ cluster status "$WORKER" -n "$TENANT_NS" ``` Do not submit work until all four conditions are `True`: | Condition | Meaning | | - | - | | `Registered` | The one-shot enrollment was redeemed. | | `Connected` | The worker tunnel is connected and its heartbeat is current. | | `WorkerConfigured` | The worker's Kueue scheduling configuration matches the Hub. | | `DispatchReady` | The Hub can dispatch work to this worker. | Check the installed components on the worker if a condition does not converge: ```bash theme={null} kubectl --context "$WORKER_CONTEXT" -n trainy-system get pods kubectl --context "$WORKER_CONTEXT" -n trainy-byoc-system get pods ``` **5. Remove the bootstrap secret** Delete the local bootstrap file and any transferred copies using your organization's secret-handling policy. On a filesystem where secure deletion is supported, remove this copy before leaving the shell: ```bash theme={null} if command -v shred >/dev/null 2>&1; then shred -u -- "$BOOTSTRAP_BLOB" || rm -f -- "$BOOTSTRAP_BLOB" else rm -f -- "$BOOTSTRAP_BLOB" fi if [[ -e "$BOOTSTRAP_BLOB" ]]; then printf 'Bootstrap secret still exists at %s; cleanup is still armed.\n' \ "$BOOTSTRAP_BLOB" >&2 else rmdir -- "$BOOTSTRAP_DIR" trap - EXIT fi ``` The exit trap still unlinks the local file after an error or interruption. `shred` cannot guarantee physical overwriting on every filesystem, including copy-on-write, journaled, snapshotted, and remote filesystems. The fallback `rm` only unlinks the file. Use your organization's approved secret-deletion procedure when unlinking is not sufficient. ## Enroll a cluster without stopping existing workloads Enrollment does not require draining the worker. The worker agent upgrades Kueue and JobSet in place to the versions selected by the organization, and a cordon prevents new Hub dispatch while that configuration converges. The cordon does not suspend or delete work already running on the cluster. Use this procedure for a worker that already runs Kueue workloads: **1. Record the running workload invariants** Capture the names, UIDs, and status of active JobSets, Jobs, and Kueue Workloads before enrollment: ```bash theme={null} kubectl --context "$WORKER_CONTEXT" -n default get jobsets -o wide kubectl --context "$WORKER_CONTEXT" -n default get jobs -o wide kubectl --context "$WORKER_CONTEXT" -n default get workloads -o wide kubectl --context "$WORKER_CONTEXT" \ get deploy -A \ -o custom-columns='NAMESPACE:.metadata.namespace,NAME:.metadata.name,READY:.status.readyReplicas,IMAGE:.spec.template.spec.containers[0].image' \ | grep -E 'kueue|jobset' ``` Keep this output until the post-enrollment check is complete. **2. Pause new Hub submissions** Pause every path that submits new work through the Hub for this organization, including user shells, CI jobs, and schedulers. Wait for any work already queued for Hub dispatch to be admitted or withdrawn before starting bootstrap. This is a short submission freeze, not a worker outage. Workloads already running on the worker continue running. > [!WARNING] > > Enrollment cannot currently create an initially cordoned WorkerCluster > atomically. Registration creates it uncordoned, so keep submissions > paused until the cluster is cordoned and enrollment validation finishes. **3. Bootstrap, then immediately cordon Hub dispatch** Start the normal bootstrap command. As soon as the `WorkerCluster` appears, run this from another trusted terminal that uses the same kubeconfig and printed Hub context: ```bash theme={null} HUB_CONTEXT=the-context-printed-in-the-first-terminal TENANT_NS=example-team WORKER=example-worker-us konduktor --context "$HUB_CONTEXT" \ cluster cordon "$WORKER" -n "$TENANT_NS" ``` `DispatchReady` remains `False` while the worker is cordoned. Existing worker-local workloads continue running. Keep organization submissions paused; the post-registration cordon alone cannot guarantee that there was no new-dispatch window. **4. Wait for dependency convergence** Watch the Kueue and JobSet Deployments while the worker agent applies the organization versions: ```bash theme={null} kubectl --context "$WORKER_CONTEXT" \ -n kueue-system rollout status deploy/kueue-controller-manager kubectl --context "$WORKER_CONTEXT" \ -n jobset-system get deploy -w ``` Older Kueue installations may pass through an intermediate compatibility release while their CRDs are rewritten to the current storage version. A cluster with many historical Workloads can spend several minutes in this step. Continue checking the recorded active workloads. Their UIDs and running status must remain unchanged. **5. Resolve existing Kueue object ownership** A brownfield cluster may already contain objects that the selected scheduling preset also manages. In that case, `WorkerConfigured` reports: ```text theme={null} refuse to adopt existing object not owned by this WorkerCluster ``` Konduktor refuses automatic adoption because it could otherwise overwrite customer-owned scheduling policy. See [Adopt existing Kueue and DWS objects](#adopt-existing-kueue-and-dws-objects) before continuing. **6. Verify the old work, then enable dispatch** Confirm the recorded JobSet, Job, and Workload UIDs still match and that the running Jobs are Ready. Then uncordon the worker: ```bash theme={null} konduktor --context "$HUB_CONTEXT" \ cluster cordon "$WORKER" -n "$TENANT_NS" --uncordon konduktor --context "$HUB_CONTEXT" \ cluster status "$WORKER" -n "$TENANT_NS" ``` Finish only when `WorkerConfigured=True` at the current WorkerCluster generation and `DispatchReady=True`. **7. Run a canary through the Hub** Submit a short JobSet through the organization's normal `user-queue`, then verify that it completes and its logs are available through Konduktor. If the organization has several dispatch-ready workers, a normal canary proves the pool, not one particular member. To prove exact routing, coordinate a short cordon of the other pool members, submit the canary, and uncordon them immediately afterward. Cordoning affects only new dispatch. **8. Resume organization submissions** Resume the user, CI, and scheduler submission paths paused before bootstrap. Workloads that were already running have remained active throughout enrollment. ## Adopt existing Kueue and DWS objects > [!WARNING] > > Do not add Konduktor ownership labels until you have compared each existing > object with the scheduling preset. Adoption authorizes the Hub to update and > later prune that object. If the specifications differ, stop and contact > Trainy to express the existing policy as WorkerCluster scheduling overlays. The `gke-dws` preset manages this complete graph: * `ResourceFlavor/default-flavor` * `ClusterQueue/cluster-queue` * `AdmissionCheck/dws-prov` * `ProvisioningRequestConfig/dws-config` * `LocalQueue/user-queue` in every organization workload namespace Inspect the cluster-scoped objects first: ```bash theme={null} for object in \ resourceflavors.kueue.x-k8s.io/default-flavor \ clusterqueues.kueue.x-k8s.io/cluster-queue \ admissionchecks.kueue.x-k8s.io/dws-prov \ provisioningrequestconfigs.kueue.x-k8s.io/dws-config do kubectl --context "$WORKER_CONTEXT" get "$object" -o yaml done ``` Then inspect the namespaced LocalQueue in every namespace listed in `WORKLOAD_NAMESPACES`: ```bash theme={null} for namespace in "${WORKLOAD_NAMESPACES[@]}" do kubectl --context "$WORKER_CONTEXT" \ -n "$namespace" \ get localqueues.kueue.x-k8s.io/user-queue -o yaml done ``` Compare the specifications and UIDs of all five object types with the intended `gke-dws` preset. After confirming they match, assign the cluster-scoped objects to this WorkerCluster without recreating them: ```bash theme={null} WORKER_IDENTITY="${#TENANT_NS}-${TENANT_NS}-${WORKER}" for object in \ resourceflavors.kueue.x-k8s.io/default-flavor \ clusterqueues.kueue.x-k8s.io/cluster-queue \ admissionchecks.kueue.x-k8s.io/dws-prov \ provisioningrequestconfigs.kueue.x-k8s.io/dws-config do kubectl --context "$WORKER_CONTEXT" label "$object" \ trainy.ai/managed-by=worker-scheduling \ trainy.ai/worker-cluster="$WORKER_IDENTITY" \ --overwrite done ``` Apply the same ownership labels to each namespaced LocalQueue: ```bash theme={null} for namespace in "${WORKLOAD_NAMESPACES[@]}" do kubectl --context "$WORKER_CONTEXT" \ -n "$namespace" \ label localqueues.kueue.x-k8s.io/user-queue \ trainy.ai/managed-by=worker-scheduling \ trainy.ai/worker-cluster="$WORKER_IDENTITY" \ --overwrite done ``` Select the DWS preset on the Hub: ```bash theme={null} kubectl --context "$HUB_CONTEXT" \ -n "$TENANT_NS" \ patch workercluster "$WORKER" \ --type merge \ -p '{"spec":{"scheduling":{"preset":"gke-dws"}}}' ``` Wait for `WorkerConfigured=True` before uncordoning. Recheck every cluster- and namespace-scoped UID to confirm that adoption updated the existing objects rather than replacing them. ## Troubleshooting ### `Registered=False` Check whether the one-shot enrollment was redeemed: ```bash theme={null} kubectl --context "$HUB_CONTEXT" \ -n "$TENANT_NS" \ get bootstrapenrollment "$WORKER" -o yaml ``` An empty `status.usedAt` means the worker did not complete registration. Check the bootstrap output and worker access to the Hub API. ### `Connected=False` Check the worker agent and outbound access to the Hub tunnel: ```bash theme={null} kubectl --context "$WORKER_CONTEXT" \ -n trainy-system logs deploy/trainy-worker-agent ``` ### `WorkerConfigured=False` Read the condition message from `konduktor cluster status`. An adoption refusal requires the review described above. Other failures usually identify the Kueue object or API that did not apply. ### `DispatchReady=False` Confirm the worker is connected, configured at the current generation, and not cordoned. `DispatchReady` becomes `True` only after the Hub's MultiKueue member is active. ### Observability says `NoTrafficYet` `ObservabilityIngestHealthy=Unknown` does not make the four enrollment conditions false. Run a canary long enough for logs and metrics to be scraped, then verify both through the Hub. A worker using the gateway transport can have queryable telemetry while the tunnel-traffic health condition still reports `NoTrafficYet`. ## Decommission or move a worker Stop new Hub dispatch before maintenance: ```bash theme={null} konduktor --context "$HUB_CONTEXT" \ cluster cordon "$WORKER" -n "$TENANT_NS" ``` To remove the Hub enrollment, then remove Trainy-installed worker components: ```bash theme={null} konduktor --context "$HUB_CONTEXT" \ cluster decommission "$WORKER" -n "$TENANT_NS" --yes konduktor --context "$WORKER_CONTEXT" worker reset --dry-run konduktor --context "$WORKER_CONTEXT" worker reset ``` `worker reset` leaves customer workloads, Kueue and JobSet objects, cert-manager, and a possibly shared VictoriaMetrics operator in place. Enrolling the cluster again requires a new one-shot bootstrap command. # Restrict batch jobs to matching clusters Source: https://docs.trainy.ai/cluster-placement Use placement labels to select a subset of your organization's worker clusters. Add `placement.trainy.ai/` labels to a task's resource labels to restrict its eligible worker clusters. An organization administrator assigns the same labels to the enrolled `WorkerCluster` objects on the Hub. ```yaml theme={null} name: east-training resources: cpus: 4 memory: 16 image_id: ubuntu:24.04 labels: kueue.x-k8s.io/queue-name: user-queue placement.trainy.ai/pool: forecasting placement.trainy.ai/region: us-east run: python train.py ``` Submit it with `konduktor launch task.yaml`. The Hub considers only clusters with **both** matching labels. Labels without this prefix do not affect cluster placement. Keys and values are case-sensitive; an empty value requires the key to exist on the cluster. The job stays queued if no eligible cluster matches. It never falls back to an unmatched cluster. Labels narrow your organization's existing cluster access; they do not grant access to another organization. Readiness, cordons, quota, resource compatibility and machine0's single-Pod restriction still apply. Multiple clusters can share a pool label. For one specific cluster, ask an administrator to assign a unique placement label and use that label on the job. These are cluster filters, so worker Nodes do not need these labels. Placement labels are fixed when a job is created. Submit a new job to change them. Administrators can relabel workers; the Hub re-evaluates pending nominations every 15 seconds. A job already assigned to a cluster stays there. Raw Kubernetes `batch/v1 Job` and `jobset.x-k8s.io/v1alpha2 JobSet` submissions use these labels on their top-level `metadata.labels`. Putting them only on a Pod template does not set a cluster restriction. Serving deployments are not supported. ## Administrator setup Label enrolled clusters on the Hub, for example: ```bash theme={null} kubectl -n forecasting label workercluster east-worker \ placement.trainy.ai/pool=forecasting placement.trainy.ai/region=us-east ``` The Hub must run the placement-aware controller, Kueue 0.19 and the custom dispatcher from the machine0 dispatch feature: ```yaml theme={null} multiKueue: dispatcherName: trainy.ai/machine0-dispatcher ``` The dispatcher supports ordinary workers with machine0 provisioning disabled. Block restricted submissions while configuring Kueue and restarting its manager; accept them only after the rollout completes. No `integrations.labelKeysToCopy` entries are needed: the Hub reads the exact owning Job or JobSet, including its UID. The `config/gke-hub` overlay pins controller image `sha-84a4e58720ed11f44d243bc8657360d40c403691` and leaves placement admission as an explicit rollout step. First promote a published image that serves `/validate-cluster-placement`. Use the target Hub's Kubernetes context, then wait for that image to finish its rollout and install the webhook: ```bash theme={null} kubectl -n trainy-controller-system rollout status \ deployment/trainy-controller-controller-manager --timeout=300s kubectl apply -f trainy-controller/config/gke-hub/cluster-placement-webhook.yaml kubectl wait --for=jsonpath='{.webhooks[0].clientConfig.caBundle}' \ validatingwebhookconfiguration/trainy-controller-cluster-placement --timeout=120s ``` The manifest keeps `failurePolicy: Fail` and selects namespaces labeled `trainy.ai/org`. It rejects placement label changes and restricted submissions when the ConfigMap does not select the custom dispatcher. The ConfigMap reports the desired dispatcher. Verify that the running Kueue manager uses that dispatcher before reopening submissions. Confirm admission of a valid tenant Job or JobSet with a server-side dry run. Custom Hubs must adapt the manifest's Service and certificate references and enable the webhook TLS listener. Keep the webhook active while restricted jobs exist. Before disabling the custom dispatcher or rolling back to an older controller, stop restricted submissions and drain those jobs. Delete the placement configuration **before** restoring an image that lacks the handler: ```bash theme={null} kubectl delete validatingwebhookconfiguration trainy-controller-cluster-placement ``` For disposable candidate tests, install the manifest after the candidate rollout and delete it before restoring an older baseline image. To inspect a queued job, find its owning Workload and check `status.nominatedClusterNames`, `status.clusterName` and its admission checks. An empty nomination list can mean that no matching worker is currently eligible. # Install Cluster Telemetry Source: https://docs.trainy.ai/cluster-telemetry Trainy: connect your own GPU cluster to Trainy in one command — metrics, infrastructure logs, Kubernetes events and GPU node health checks, installed with Helm and shipped from a namespace you control. This guide is for the team that operates the Kubernetes cluster. It installs the components Trainy needs to see your cluster's health, so we can run dashboards, alerts and GPU fault triage against it. The whole install is a handful of Helm releases and one custom resource. It adds no Prometheus, no Grafana, no exporters and no scheduler, and it does not modify the monitoring stack you already run. > [!NOTE] > > Before you start you need two things from Trainy: a **cluster identifier** > (everything you ship is filed under it) and **confirmation that your cluster's > egress IP is allowlisted** on the ingest endpoint. Without the allowlist the > install comes up perfectly healthy and ships nothing. ## What gets installed | Component | What it is | What it does | | - | - | - | | VictoriaMetrics operator | One Deployment | Converts the ServiceMonitors your monitoring stack already defines into scrape targets for the agent below. Installs no Prometheus and no storage. | | Metrics shipper | A `VMAgent` custom resource | Scrapes those targets and remote-writes a **copy** to Trainy. Your Prometheus keeps scraping exactly what it scraped before. | | Log shipper | OpenTelemetry Collector, DaemonSet | Ships pod logs from an **allowlist of infrastructure namespaces**. Default deny. | | Event shipper | OpenTelemetry Collector, Deployment | Ships Kubernetes events (OOMKills, scheduling failures, node pressure) from allowlisted namespaces, plus all node events. | | Node health | `trainy-npd` DaemonSet + remediation controller | Runs GPU, RDMA, PCIe, NVMe and kernel checks, publishing results as `trainy.ai/*` NodeConditions, and acts on them by default — see [Node health and auto-remediation](#node-health-and-auto-remediation). | | Kernel logs | `dmesg`, DaemonSet on every node | Streams each node's kernel ring buffer, which the log shipper forwards. Runs **privileged** — see below. | **Exporters are not installed.** `kube-state-metrics`, `node-exporter` and the GPU metrics exporter belong to whoever runs your monitoring stack. This install reads them and reports at preflight which ones it can find. ## What leaves your cluster Worth reading before you install, and worth showing to whoever asks. > [accordion] Metrics — whatever your ServiceMonitors define > > The agent discovers targets by converting the ServiceMonitors already in > your cluster, plus one static job for the GPU exporter. That is what makes > the install work without us writing scrape configs for exporters we do not > own — and it means **the set of shipped metrics is the set your monitoring > stack already collects**. If you have a ServiceMonitor for an application, > that application's metrics ship too. > > To narrow it, replace `selectAllByDefault: true` in `manifests/vmagent.yaml` > with label selectors naming the scrapes you want. Trainy needs the > infrastructure ones: kube-state-metrics, node-exporter, kubelet, and the GPU > exporter. > > Worth naming either way: `kube-state-metrics` emits a series per Kubernetes > object cluster-wide, so workload **names** (namespace, pod, job) reach > Trainy. Not your data — the shape of it. > [accordion] Logs — an allowlist of infrastructure namespaces > > Only namespaces you list are collected. A namespace you create tomorrow is > excluded automatically, because it is not on the list — not because a filter > caught it. > > This is enforced in two independent places: the collector's file globs (a > log file that is not matched is **never opened**, so those bytes never enter > the process) and a namespace filter that fails **closed** on any record > whose namespace cannot be resolved. The installer generates both from the > single `LOG_NAMESPACES` setting, so they cannot drift apart. > > The default list is infrastructure only — your GPU operator, networking, > monitoring, scheduler and Trainy namespaces. Your workload namespaces are > not on it and should not be. > [accordion] Events — a shorter allowlist, plus node events > > Kubernetes events carry pod, job and workload names, so the same default > deny applies, enforced on the receiver itself: unlisted namespaces are never > watched. > > Node events are collected separately and deliberately — they are how "the > GPU node went away" becomes "the kubelet stopped posting status at 04:12". > That watch is constrained by the API server to events whose subject is a > **Node**, so events about your pods are never sent to the collector at all, > even though the watch is cluster-wide. > [accordion] Kernel logs — every node, and a privileged container > > The `dmesg` DaemonSet runs `dmesg -w` on every node and writes the kernel > ring buffer to stdout, where the log shipper forwards it like any other pod > log. This is where hardware failure shows up first and in the most detail: > Xid faults, PCIe AER corrections, mlx5 link events, NVMe timeouts, soft > lockups. None of it appears in any application log. > > **The container runs privileged**, because reading the kernel ring buffer > requires it. Expect this to be the item your security review stops on, so: > it runs one command, `dmesg -w`, and nothing else — no host filesystem > mounts, no network listeners, no writes. It runs in its own namespace > precisely so a pod-security exception for it can be scoped to that one > namespace rather than granted where every other Trainy component runs. > > Kernel logs are node-level, not workload-level. They can name a process that > triggered an OOM kill, which is the one place workload detail can appear. > Set `INSTALL_DMESG=false` if that is not acceptable — everything else keeps > working, and node health detection is unaffected, since those checks read > the kernel directly rather than through this DaemonSet. > [accordion] What is never collected > > No workload payloads, no application logs, no secrets, no container > filesystem contents, no traces, and no exec or shell access. The collectors > only push outward — nothing in this install opens a listening port for > inbound traffic, and nothing gives Trainy a path into your cluster. ## Prerequisites * Kubernetes cluster with GPU nodes, `kubectl` configured, cluster-admin * `helm` 3.8 or newer * Outbound HTTPS from the cluster to the Trainy ingest endpoint * Your cluster identifier from Trainy * A monitoring stack already running `kube-state-metrics`, `node-exporter` and a GPU metrics exporter, with ServiceMonitors for them > [!WARNING] > > `kube-state-metrics` is the one that matters most. Every node health condition > reaches Trainy as a `kube_node_status_condition` series from it — without it, > the checks run and nobody ever sees the results. `node-exporter` should > include the `--collector.infiniband` flag, or RDMA and InfiniBand link metrics > will be missing. ## Install **1. Get the installer** ```bash theme={null} git clone https://github.com/Trainy-ai/trainy-telemetry cd trainy-telemetry ``` The bundle is a single directory: the installer, one config file, and the Helm values and manifests it applies. Everything in it is readable, and the values files are commented with what each setting does and why. Nothing is fetched at install time except the upstream Helm charts and container images, all from public registries. **2. Configure** ```bash theme={null} cp trainy-telemetry.conf.example trainy-telemetry.conf $EDITOR trainy-telemetry.conf ``` The defaults match Trainy's reference GPU cluster, so on a cluster of the same shape the only setting you must fill in is `CUSTOMER`, the identifier Trainy gave you. The ones most worth a look: | Setting | Why you would change it | | - | - | | `KUBE_CONTEXT` | You have more than one cluster configured. | | `GPU_NODE_SELECTOR` | Your GPU nodes carry a different label (AMD clusters usually do). | | `EXPECTED_GPUS` | Your nodes do not have 8 GPUs. | | `RDMA_INTERFACES` / `IB_EXPECTED_ACTIVE_PORTS` | **Expect to set these.** See [Fabric settings](#fabric-settings) — the default inspects every RDMA device, which alarms on the non-fabric ones. | | `LOG_NAMESPACES` / `EVENT_NAMESPACES` | Your infrastructure lives in differently-named namespaces. | | `NODE_HEALTH_MODE` | You want auto-remediation, not just detection — see [below](#node-health-and-auto-remediation). | Keep this file. Re-running the installer with it is how you upgrade or change the install later. **3. Preview** ```bash theme={null} ./install.sh --dry-run ``` This changes nothing. It checks your cluster, reports which exporters and ServiceMonitors it found, tests that the ingest endpoints are reachable, and prints everything it would apply — including the generated allowlists and the fully rendered VMAgent. **4. Install** ```bash theme={null} ./install.sh ``` Safe to re-run at any time. It finishes by verifying each component rolled out and listing the node health conditions being published. **5. Confirm with Trainy** Tell Trainy the install is up. We will confirm your data is arriving and that ingest is allowlisted for your egress IP. ## Verify ```bash theme={null} ./install.sh --verify # rollout status of every component, no changes ``` Locally: ```bash theme={null} kubectl -n vm-operator get pods kubectl -n vm-operator logs deploy/vmagent-vmagent- --tail=20 kubectl -n otel-collector get pods kubectl -n trainy-system get pods kubectl -n dmesg-logging get pods # node health checks reporting in: kubectl get nodes -o json | grep -o '"type": *"trainy\.ai/[^"]*"' | sort -u ``` A healthy install shows the operator and VMAgent Deployments, both collectors, and one node-health pod per GPU node, all `Running`. ## GPU metrics Per-GPU health — utilisation, temperature, throttling, XID faults — comes from your GPU metrics exporter, configured through your GPU operator. The installer tells you at preflight whether it found one; if not, enable it: ```bash theme={null} helm upgrade nvidia/gpu-operator \ -n gpu-operator --reuse-values \ --set dcgmExporter.enabled=true ``` > [!WARNING] > > If you supply a custom DCGM metrics list, it **replaces** the exporter's whole > metric set rather than adding to it. Copying someone else's list will delete > whatever they did not have and break your own dashboards. Capture your current > metric set first, then add to it. Two things about XID metrics that confuse everyone at least once: * `DCGM_FI_DEV_XID_ERRORS` reads "no data" on a healthy cluster. That is correct, not a misconfiguration: DCGM emits a blank rather than a zero for a GPU with no XID since boot, and the exporter drops blanks, so the series does not exist until a fault occurs. `DCGM_EXP_XID_ERRORS_COUNT` always emits a value — alert on that one. * You are not blind to XID faults without any of this. The node health checks read the kernel ring buffer directly and set a `trainy.ai/GpuXid` condition. DCGM adds per-GPU attribution on top. ## Fabric settings You do not declare InfiniBand versus RoCE anywhere. The checks read `ibstat` and `/sys/class/infiniband` directly and detect what is there — a node with no RDMA devices is a healthy skip, and the RoCE-specific paths (MTU consistency, hardware counters) activate on their own when RoCE devices are present. What you do need to tell it is **which devices carry training traffic**. A typical 8-GPU node exposes roughly 24 mlx5 devices, of which about 16 are fabric rails; the rest are storage, management, or restricted physical functions whose ports are legitimately not Active. Left unset, the port-state check inspects all of them and alarms on every node at once. Trainy sets this explicitly on every cluster it operates, and you should too: ```bash theme={null} # CA names present on a GPU node ibstat -l # which are Active, and InfiniBand vs Ethernet (RoCE) ibv_devinfo | grep -E 'hca_id|link_layer|state' ``` Put the training-fabric devices in `RDMA_INTERFACES`, and set `IB_EXPECTED_ACTIVE_PORTS` to how many of them should be Active on a healthy node — normally the length of that list. Getting the count wrong raises a condition on every node simultaneously, which is the signature of a misconfiguration rather than a fault. > [!NOTE] > > Everything else has a working default: expected NIC and NVLink counts, kernel > modules, NUMA topology, RoCE counter selection, link-flap thresholds. They are > all reachable through `npd.env` if you need them, and the chart's own > `values.yaml` documents each one inline. Ask Trainy before changing them — > most are tuned against specific failure modes seen in production. Note that NCCL variables for your **training jobs** — `NCCL_IB_HCA`, `NCCL_IB_GID_INDEX`, `NCCL_SOCKET_IFNAME` — are a separate concern and are not set by this install. If you use a fixed GID index on RoCE, be aware that a link flap can leave the conventional index empty with the real address one slot further along, which breaks jobs pinned to it on that device only. ## Node health and auto-remediation `NODE_HEALTH_MODE` has two settings, and **the default acts on your nodes**. **`remediate` (default).** The checks run on your GPU nodes and publish results as `trainy.ai/*` NodeConditions, and the controller acts on them: a faulted node is cordoned, handed to your hardware provider for repair, validated once it returns, and put back into service — escalating to a human when automated repair fails. This is the chart's own default and what Trainy runs on its own clusters. **`detect`.** Checks only. Conditions are still published, still turn into `kube_node_status_condition` metrics, and are still alertable — nothing is cordoned, drained or repaired. Use it for a phased rollout: watch what the checks *would* have acted on for a week, then switch. Which conditions may act on a node is set per condition in `values/node-health.yaml`. Hard faults that make a node unfit for work (XID, ECC, GPU count, fabric manager, NVLink, RDMA link) can cordon it; diagnostic or fleet-wide signals (DNS, AER, MTU, bit error rate, module temperature) report only. That file is where you change the split. > [!WARNING] > > Because `remediate` is the default, a plain `./install.sh` gives the > controller authority over your GPU nodes. What that authority is bounded by: > > * `REMEDIATION_MODE` defaults to **`Provider`**, meaning your hardware > provider performs the physical repair and the controller only drives the > state machine around them — cordon, wait, validate, restore. It does not > reboot nodes itself. `InCluster`, which does, is the deliberate exception > and is not the default here even though it is the chart's. > * `DRAIN_POLICY` defaults to `auto`, but Provider mode does not evict > workloads except for the few conditions where the running workload *is* the > fault (a GPU still thermally throttling an hour in). Set `askApproval` to > gate even those on a human. > * Know that the controller **projects** node state: it will revert a manual > `kubectl cordon` or `uncordon` on a node it is managing. To take durable > manual control of a node, delete its `NodeRemediation` resource. > * The installer patches your GPU operator's `ClusterPolicy` so GPU DaemonSets > tolerate the remediation taint. Without that, a node under repair reports > zero allocatable GPUs and can never pass the validation that would return it > to service. A later `helm upgrade` of your GPU operator wipes that patch — > re-run the installer afterwards. To start in detect-only and switch later, both directions are a config edit plus a re-run: ```bash theme={null} sed -i 's/^NODE_HEALTH_MODE=.*/NODE_HEALTH_MODE=detect/' trainy-telemetry.conf ./install.sh # controller removed; checks and alerting keep running ``` ## AMD GPU clusters Set `GPU_VENDOR=amd` in your config. Everything else in this guide applies unchanged — metrics, logs, events and kernel logs are vendor-neutral; only the node health checks differ. ``` GPU_VENDOR=amd ``` That layers `values/node-health-amd.yaml` onto the base profile. **The NVIDIA checks do not run on AMD hardware**, and this is not a cosmetic distinction: Xid, DCGM health, NVLink speed, fabric manager and GPU bus enumeration all read NVIDIA interfaces that do not exist on an AMD node. In their place the AMD check set runs: | Runs on AMD | Emits | | - | - | | AMD GPU checks | `amd-GpuCount` `amd-GpuDriver` `amd-GpuDriverWarn` `amd-GpuEcc` `amd-GpuPcie` `amd-Kfd` `amd-KfdDeadlock` `amd-Xgmi` `amd-GpuBadPages` `amd-DevicePlugin` | | Vendor-neutral | PCIe ACS/AER, NVMe, DNS, pod-network DNS, egress, kernel modules, thermals, power brake, RDMA NIC count | The Mellanox-specific pieces are off: the `mlxlink` PHY checks and its exporter sidecar need Mellanox Firmware Tools, and the mlx5 kernel-message and link-flap checks read a driver AMD/Pensando NICs do not use. The RoCE checks (`ibPortState`, `roceMtu`, `rdmaGidLayout`) are off too — they self-skip on a node with no RDMA devices rather than failing, so this is about avoiding noise. If your AMD cluster does run RDMA NICs exposing `/sys/class/infiniband`, re-enable `ibPortState` first and confirm it reports cleanly before adding the others. Post-repair validation switches automatically: the controller requests `amd.com/gpu`, runs a HIP burn instead of the NVIDIA one, and the NCCL rung is disabled. > [!WARNING] > > The node label matters more than it looks. Helm **merges** map values, so > setting an AMD label without removing the NVIDIA one leaves the DaemonSet > requiring *both* — and it then schedules on zero nodes, silently, because a > DaemonSet with an unsatisfiable selector is not an error. The AMD profile > removes the inherited key explicitly. > > With `GPU_VENDOR=amd` and `GPU_NODE_SELECTOR` left at its default, the > installer switches to `feature.node.kubernetes.io/amd-gpu=true` for you. If > your AMD nodes carry a different label, set it — and if you set an > `nvidia.com/*` label with `GPU_VENDOR=amd`, the installer stops rather than > installing something that can never schedule. ## Day-2 operations ```bash Change what is shipped theme={null} $EDITOR trainy-telemetry.conf # e.g. edit LOG_NAMESPACES ./install.sh ``` ```bash Upgrade theme={null} git pull # picks up new pinned chart versions ./install.sh ``` ```bash Pause shipping theme={null} kubectl -n vm-operator scale deploy/vmagent-vmagent- --replicas=0 kubectl -n trainy-system scale deploy/otel-deployment-central --replicas=0 ``` ```bash Remove everything theme={null} ./install.sh --uninstall ``` `--uninstall` removes only what the installer created. Your monitoring stack, your exporters and any namespace it did not create are left alone. Helm never removes CRDs, so the node-health CRDs stay until you delete them explicitly. ## Installing by hand If you would rather not run a script, every component is a plain Helm release or a single manifest, and every file in `values/` carries its exact install command in the header. In short: ```bash theme={null} helm repo add vm https://victoriametrics.github.io/helm-charts/ helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts helm repo update # metrics: operator, then the agent helm upgrade --install victoria-metrics-operator vm/victoria-metrics-operator \ -n vm-operator --create-namespace --version 0.67.2 \ -f values/vm-operator.yaml # edit manifests/vmagent.yaml, replacing the __PLACEHOLDER__ values, then: kubectl apply -f manifests/vmagent.yaml # logs helm upgrade --install otel-central open-telemetry/opentelemetry-collector \ -n otel-collector --create-namespace --version 0.131.0 \ -f values/otel-logs.yaml \ --set-string 'config.processors.resource/customer.attributes[0].value=' # events helm upgrade --install otel-deployment-central open-telemetry/opentelemetry-collector \ -n trainy-system --create-namespace --version 0.171.0 \ -f values/otel-events.yaml \ --set-string 'config.processors.resource/customer.attributes[0].value=' # until 2026-10-02 this release lived in otel-collector; retire that copy once # the new one is up, or events ship twice kubectl -n trainy-system rollout status deploy/otel-deployment-central --timeout=120s \ && helm status otel-deployment-central -n otel-collector >/dev/null 2>&1 \ && helm uninstall otel-deployment-central -n otel-collector # node health — checks AND the remediation controller (Provider mode). # Add --set controller.enabled=false for detection only. helm upgrade --install trainy-remediation \ oci://ghcr.io/trainy-ai/charts/trainy-remediation \ -n trainy-system --create-namespace -f values/node-health.yaml \ --set expectedGpus= \ --set-string 'npd.env[0].name=RDMA_INTERFACES' \ --set-string 'npd.env[0].value=' ``` > [!WARNING] > > This installs a working remediation pipeline, not just the checks — the chart > enables the controller by default and `values/node-health.yaml` does not > override it. A faulted GPU node will be cordoned and handed to your provider. > Append `--set controller.enabled=false` if you want detection only. Two more differences from the installer worth knowing if you go this route. It does not create a `NodePool`, so repaired nodes are not promoted out of standby automatically. And `drainPolicy` falls back to the chart's `askApproval` rather than the installer's `auto` — more conservative, and it means a drain waits on a human. See [Fabric settings](#fabric-settings) for the per-cluster values above. > [!WARNING] > > Installing the log shipper by hand means maintaining the namespace allowlist > in **two** places inside `values/otel-logs.yaml` — the file globs and the > filter regex — and keeping them identical. They fail differently when they > drift: a namespace in the globs only is collected and then dropped; a > namespace in the filter only is never read at all. The installer generates > both from one list precisely to remove that trap. # Common Commands Source: https://docs.trainy.ai/commands Commands for launching and managing your Konduktor Jobs > [!TIP] > > **AI-Assisted Workflows:** Install the [Konduktor Skills](https://github.com/Trainy-ai/konduktor-skills) plugin to get AI help drafting task YAMLs (`/draft-task-yaml`), writing Python SDK code (`/draft-python-task`), and constructing CLI commands (`/konduktor-cli`). > > ```bash theme={null} > npx skills add Trainy-ai/konduktor-skills > ``` ### Create a Job ``` konduktor launch my_job.yaml ``` ### Fetch Job Statuses ``` konduktor status konduktor status --limit # gets only most recent jobs konduktor status --before # gets only jobs before konduktor status --after # gets only jobs after konduktor status --all-users # gets all jobs for all users ``` ### Stream Logs ``` konduktor logs konduktor logs --no-follow # gets all logs without streaming konduktor logs --num-lines # num of lines from the end of log file to show konduktor logs --start-offset