> This page is for version Main (default).
> For other versions, use one of these documentation indexes:
> - Main (default): https://docs.nvidia.com/nemo/gym/main/llms.txt
> - 0.7.0: https://docs.nvidia.com/nemo/gym/v0.7.0/llms.txt
> - 0.6.0: https://docs.nvidia.com/nemo/gym/v0.6.0/llms.txt
> - 0.5.1: https://docs.nvidia.com/nemo/gym/v0.5.1/llms.txt
> - 0.5.0: https://docs.nvidia.com/nemo/gym/v0.5.0/llms.txt
> - 0.4.0: https://docs.nvidia.com/nemo/gym/v0.4.0/llms.txt
> - 0.3.0: https://docs.nvidia.com/nemo/gym/v0.3.0/llms.txt
> - 0.2.1: https://docs.nvidia.com/nemo/gym/v0.2.1/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/gym/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/gym/_mcp/server.

# nemo_gym.orchestration.executors.kubernetes

Kubernetes executor: one `kubectl apply` per benchmark, no SSH/rsync.

Assumes the kubeconfig is already set up (e.g. `tsh kube login &lt;cluster&gt;`) the same way the Slurm
executor assumes SSH keys/agent are already set up -- this executor does not drive cluster auth.

## Module Contents

### Classes

| Name                                                                                    | Description                                                                               |
| --------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| [`KubernetesExecutor`](#nemo_gym-orchestration-executors-kubernetes-KubernetesExecutor) | Kubernetes executor. One Job per benchmark; see `kubernetes_script.py` for the pod shape. |

### Functions

| Name                                                                                                  | Description |
| ----------------------------------------------------------------------------------------------------- | ----------- |
| [`_kubectl`](#nemo_gym-orchestration-executors-kubernetes-_kubectl)                                   | -           |
| [`_validate_benchmark_names`](#nemo_gym-orchestration-executors-kubernetes-_validate_benchmark_names) | -           |

### Data

[`_KUBECTL_TIMEOUT_SECONDS`](#nemo_gym-orchestration-executors-kubernetes-_KUBECTL_TIMEOUT_SECONDS)

[`_VALID_BENCHMARK_NAME`](#nemo_gym-orchestration-executors-kubernetes-_VALID_BENCHMARK_NAME)

### API

```python
class nemo_gym.orchestration.executors.kubernetes.KubernetesExecutor()
```

**Bases:** [BaseExecutor](/nemo/gym/nemo-gym/nemo_gym/orchestration/executors/base#nemo_gym-orchestration-executors-base-BaseExecutor)

Kubernetes executor. One Job per benchmark; see `kubernetes_script.py` for the pod shape.

**`name`** `= 'kubernetes'`

---

```python
nemo_gym.orchestration.executors.kubernetes.KubernetesExecutor._build_manifests(
    config: nemo_gym.orchestration.api.SubmitConfig,
    compute: nemo_gym.orchestration.api.KubernetesComputeConfig,
    gym_job_id: str,
    now: datetime.datetime,
    base_run_dir: pathlib.Path,
    benchmark_names: list[str]
) -> list[tuple[str, dict]]
```

```python
nemo_gym.orchestration.executors.kubernetes.KubernetesExecutor._dry_run(
    manifests: list[tuple[str, dict]],
    gym_job_id: str
) -> None
```

```python
nemo_gym.orchestration.executors.kubernetes.KubernetesExecutor.resubmit(
    record: nemo_gym.orchestration.jobs.SubmissionRecord,
    benchmark: str
) -> nemo_gym.orchestration.jobs.BenchmarkJob
```

```python
nemo_gym.orchestration.executors.kubernetes.KubernetesExecutor.run(
    config: nemo_gym.orchestration.api.SubmitConfig,
    dry_run: bool = False
) -> nemo_gym.orchestration.jobs.SubmissionRecord | None
```

```python
nemo_gym.orchestration.executors.kubernetes._kubectl(
    compute: nemo_gym.orchestration.api.KubernetesComputeConfig,
    args: str = (),
    input: str | None = None
) -> subprocess.CompletedProcess
```

```python
nemo_gym.orchestration.executors.kubernetes._validate_benchmark_names(
    benchmarks: list[str]
) -> None
```

```python
nemo_gym.orchestration.executors.kubernetes._KUBECTL_TIMEOUT_SECONDS = 60
```

```python
nemo_gym.orchestration.executors.kubernetes._VALID_BENCHMARK_NAME = re.compile('^[a-z0-9][a-z0-9._-]*$')
```