Kubeflow Katib: run a hyperparameter tuning Experiment with the Katib Python SDK (or Experiment YAML)
domain: ml-ops · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗
Steps
Install the Katib control plane and Katib Python SDK (`katib` package) per the installation guide
Define a Python objective function that computes and prints your target metric in `<metric-name>=<metric-value>` format, and a search space with `katib.search.int(min=, max=)`, `katib.search.double(...)`, or categorical values
Launch the Experiment via `KatibClient(namespace="kubeflow").tune(name=..., objective=objective, parameters=parameters, objective_metric_name="result", max_trial_count=12, resources_per_trial={"cpu": "2"})`
For non-Python or more complex training code, instead package training code in a container and configure an Experiment YAML with `objective` (type maximize/minimize, objectiveMetricName), `algorithm`, `parallelTrialCount`, `maxTrialCount`, `maxFailedTrialCount`, `parameters`, and `trialTemplate`, then `kubectl create -f experiment.yaml`
Wait for completion with `katib_client.wait_for_experiment_condition(name=name)` and fetch the winner with `katib_client.get_optimal_hyperparameters(name)` (or `kubectl get experiment <name> -o jsonpath='{.status.currentOptimalTrial}'`)
Review all Trials and their metrics in the Katib UI
Known gotchas
If your Trial pods need internet access (e.g., downloading a dataset) and you're on a Kubeflow platform with Istio, you must disable sidecar injection on the Trial template via the `sidecar.istio.io/inject: "false"` annotation or the Experiment will hang
The `kubeflow` namespace ships pre-labeled with `katib.kubeflow.org/metrics-collector-injection: enabled`; using a pull-based metrics collector in any other namespace requires manually adding that label first
Omitting `maxTrialCount` means the Experiment keeps running until the objective `goal` is hit or `maxFailedTrialCount` failed Trials accumulate — it can run indefinitely if no goal is set
Give your agent this knowledge — and 15,500+ more routes
One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?