Skip to content

Katib

Interactive Diagram

새 탭 ↗
ItemValue
VersionKatib v0.19.0
Official docsKubeflow Katib
Upstream sourceapplications/katib/upstream
Dev overlayoverlays/dev/kubeflow/overlays/katib

Katib is not a component that provides training code itself. It is the HPO control plane that explores parameter combinations and runs the training workload for each combination as a Trial. A user creates an Experiment in a Profile namespace and declares the objective metric, the parameter ranges, the trial template, and the algorithm. The Katib controller reconciles the Experiment to create a Suggestion resource and an algorithm Pod, and for each proposed parameter set it creates a Trial resource and a Job or Kubeflow training resource.

Katib takes the objective and search space of an Experiment, proposes parameters through Suggestion, runs a training workload per Trial, and collects metrics Source: Kubeflow docs, Katib Experiment CR, The Kubeflow Authors, CC BY 4.0

When the Trial workload records metrics to stdout, a file, or TensorFlow events, the Katib metrics collector collects them. The objective metric collected by the collector is stored in the katib logical database of the shared MySQL through the Katib database manager, and the controller uses the results to request the next parameter proposal or to complete the Experiment. The declarations and status of Experiment, Trial, and Suggestion are managed as Kubernetes CRs, and the database is used for metric observations and Katib internal persistence.

ResourceAPIRole
Experimentkubeflow.org/v1beta1Declares the HPO goal, parameter space, algorithm, Trial template, and maximum Trial count.
Trialkubeflow.org/v1beta1Represents one parameter combination, its execution status, and its metric results.
Suggestionkubeflow.org/v1beta1Delivers the next parameter combinations generated by the algorithm Pod to the controller.
Trial workloadbatch/v1 Job or training CRRuns the actual training. Only resources allowed in KatibConfig are used.

Experiment, Trial, and Suggestion are namespace-scoped CRDs. The user’s HPO definitions and Trial workloads therefore live in the Profile namespace that created the Experiment, not in kubeflow, the control plane namespace.

  • HPO control plane: katib-controller reconciles Experiment, Trial, and Suggestion and manages the Trial lifecycle.
  • Algorithm runtime: random, TPE, grid, Hyperband, Bayesian optimization, CMA-ES, Sobol, ENAS, DARTS, and PBT suggestion images are provided through katib-config.
  • Metric collection: a Pod mutating webhook that targets a namespace label injects the collector sidecar.
  • Result persistence: katib-db-manager records Experiment and Trial results in the katib logical database.
  • Dashboard UI: katib-ui shows Experiment and Trial status on the /katib/ route and checks requests with Kubernetes RBAC.
  • Admission protection: the Experiment validate/default webhooks and the metrics collector injection webhook are provided on a certificate basis.

If Notebooks and Pipelines define training code and data flow, Katib explores the parameter combinations used for repeated training. For example, if learning rate, batch size, and optimizer momentum are declared as the search space, Katib creates several Trials and returns the best objective metric, without requiring the user to hand-author every run.

  • Profile namespace isolation: Experiments and Trials are created in the requesting user’s namespace and do not mix with the HPO results or workloads of other Profiles.
  • Workload type choice: besides the default Job, TFJob, PyTorchJob, MPIJob, XGBoostJob, and Trainer TrainJob can be used as the Trial template. The actual allowed list is determined by trialResources in katib-config.
  • Automated metric collection: the Profile controller gives the namespace the katib.kubeflow.org/metrics-collector-injection=enabled label. Every Pod CREATE request in a namespace with this label goes through Katib mutating webhook admission, and the metrics collector settings are applied to Pods that match Katib Trial metadata.
  • Dashboard integration: the /katib/ route on the Kubeflow gateway connects to katib-ui. The UI backend checks the user’s namespace permissions with SubjectAccessReview.
  • Training component integration: Katib only creates Trial resources and workloads and does not perform model serving or Model Registry registration. Training finalized with the best parameters and model registration are done separately in the Pipeline, Trainer, and Model Registry flows.

The dev overlay references the upstream katib-with-kubeflow variant. This variant includes the Katib control plane, the cert-manager webhook certificate, the Istio UI route and AuthorizationPolicy, and the Kubeflow UI RBAC patch.

overlays/dev/kubeflow/overlays/katib
-> applications/katib/upstream/installs/katib-with-kubeflow
-> katib-cert-manager
-> controller / CRD / db-manager / mysql / UI / webhook
-> kubeflow Katib roles
-> katib-ui VirtualService + AuthorizationPolicy
overlay patch
-> upstream katib-mysql Deployment / PVC / default Secret 제거
-> katib-mysql Service -> ps-db-haproxy.mysql.svc.cluster.local
-> katib-db-manager -> mysql / katib database / local credential Secret

Katib’s control plane Deployments are placed in the kubeflow namespace. katib-controller and katib-db-manager disable Istio sidecar injection, as in upstream. katib-ui, on the other hand, gets the Istio sidecar injected and allows only traffic from the gateway through an AuthorizationPolicy.

Katib does not use its own database Deployment. It keeps the upstream resource name katib-mysql Service as a namespace-local ExternalName alias and connects it to the shared Percona MySQL HAProxy writer endpoint.

ItemCurrent valueMeaning
Database drivermysqlDatabase engine of katib-db-manager
Logical databasekatibMetric observations and Katib internal persistence
Alias Servicekatib-mysqlNamespace-local hostname referenced by katib-db-manager
Real endpointps-db-haproxy.mysql.svc.cluster.local:3306Shared Percona MySQL writer
Credential Secretkatib-mysql-secretsLocal-only Secret that provides DB_USER and DB_PASSWORD

The actual values of katib-mysql-secrets are not included in the overlay. katib-db-manager reads both DB_USER and DB_PASSWORD from this Secret. The upstream default Secret, the in-cluster katib-mysql Deployment, and the PVC are all removed from the build output. Database creation, application role, grants, backup, and failover follow the platform contract in Shared data services (MySQL and Object Storage).

The Katib application role must be granted only the katib database. It does not share privileges on KFP’s mlpipeline, cachedb, and metadb or on Model Registry’s model_registry.

katib-controller watches Experiments and reads the objective and algorithm settings. When the controller creates a Suggestion resource, the algorithm Pod generates parameter combinations. Based on that result, the controller creates a Trial and a workload based on the user-provided trial template in the corresponding Profile namespace.

Because the Profile namespace has the metrics collector injection label, every Pod CREATE request in that namespace goes through the Katib mutating webhook. The collector settings are applied to workload Pods that match Katib Trial metadata, and the collector sends the objective metric to the database manager API. The controller asks the algorithm for the next Suggestion based on the stored observations, and ends the Experiment when maxTrialCount, the number of successful Trials, or the objective condition is met.

katib-config is a ConfigMap mounted into the controller that defines the supported Trial resources, the collector image, the suggestion images, and the early stopping images. The PBT algorithm is defined to request a ReadWriteMany PVC for persistent state, so the cluster must have an RWX storage class when that algorithm is used. If the cluster has no RWX-capable StorageClass, PBT will not work correctly even if Katib itself is healthy.

Katib provides a cluster-scoped ValidatingWebhookConfiguration and MutatingWebhookConfiguration.

WebhookTargetRole
validator.experiment.katib.kubeflow.orgExperiment CREATE, UPDATEValidates the search space, objective, and Trial template settings.
defaulter.experiment.katib.kubeflow.orgExperiment CREATE, UPDATEFills in default values.
mutator.pod.katib.kubeflow.orgPod CREATE in labeled namespacesInjects the metrics collector sidecar.

All webhooks call the TLS endpoint of the katib-controller.kubeflow Service. cert-manager creates the katib-webhook-cert Certificate and Secret, and fills the webhook caBundle through the CA injection annotation. If an Experiment or Trial Pod is created before the certificate or controller readiness is in place, admission requests can fail, so control plane health must be checked first. In other words, cert-manager health is not optional: a broken certificate, controller readiness, or CA bundle injection can fail admission before any search even begins.

NamespaceResourceNamePurpose
kubeflowDeployment + Servicekatib-controllerHPO reconcile, webhook, Prometheus metrics endpoint
kubeflowDeployment + Servicekatib-db-managerKatib database API and MySQL persistence
kubeflowExternalName Servicekatib-mysqlShared Percona MySQL writer alias
kubeflowDeployment + Servicekatib-ui/katib/ UI and user RBAC checks
kubeflowConfigMapkatib-config, trial-templatesSupported Trial resources, algorithms, collector, and default templates
kubeflowCertificate + Secretkatib-webhook-certController webhook TLS certificate
kubeflowVirtualService + AuthorizationPolicykatib-uiGateway route and UI inbound access control
clusterCRDexperiments.kubeflow.org, trials.kubeflow.org, suggestions.kubeflow.orgHPO declaration and status API
clusterwebhook configurationkatib.kubeflow.orgExperiment validation/defaulting and metrics collector injection
Profile namespaceExperiment, Trial, SuggestionCreated dynamically per userParameter search, Trial status, suggestion results
Profile namespaceJob or training resource PodCreated dynamically per TrialActual training and metric output
mysqlPercona MySQL Cluster + Serviceps-db, ps-db-haproxyProvides the katib logical database

PlantUML source:

PlantUML Diagram

From Experiment to selecting the best parameters

Section titled “From Experiment to selecting the best parameters”
  1. A user creates an Experiment in a Profile namespace through the Dashboard UI, the SDK, or kubectl.
  2. The Kubernetes API server calls the Experiment validating/defaulting webhook on katib-controller.
  3. The controller reconciles the Experiment and creates a Suggestion for which the algorithm Pod provides parameter combinations.
  4. Based on the Suggestion, the controller creates a Trial and the Job or training resource from the trial template in the same namespace.
  5. The CREATE request for the Trial Pod goes through Katib Pod mutating webhook admission, and the metrics collector settings are applied if it matches the Trial metadata. The trial emits metrics to stdout, a file, or TensorFlow event format.
  6. The collector sends the objective metric to the database manager, and the manager records it in the katib database of the shared MySQL.
  7. The controller creates the next Trial based on the observations, or records the best result in the Experiment status when the goal and Trial count conditions are met.

PlantUML source:

PlantUML Diagram
  • Prerequisite: cert-manager and katib-webhook-cert must be Ready for Experiment and Trial Pod admission to work.
  • Prerequisite: the shared Percona MySQL writer endpoint, the katib database, the Katib application role, and katib-mysql-secrets must be Ready for katib-db-manager to start.
  • Prerequisite: the Profile controller must prepare the namespace label and Kubeflow RBAC for multi-user metrics collection and per-user Experiment access.
  • Downstream: to use Trainer’s TrainJob as a Trial template, the Trainer CRDs and controller must be ready first.
  • kubeflow-gateway and the katib-ui AuthorizationPolicy protect /katib/ UI traffic.
  • The Kubernetes API server calls the controller’s TLS webhook endpoint for Experiment and Pod admission.
  • Only katib-db-manager connects to the shared MySQL through the katib-mysql alias. The controller and UI do not connect to the database directly.
  • The Trial template determines the image, ServiceAccount, Secret, PVC, and GPU resources. Katib does not automatically synchronize these with Notebook or Pipeline settings. Notebook, Pipeline, storage, dataset access, GPU quota, Secrets, and PVC mounting are all outside Katib’s control and must be defined in the trial template or namespace policy.
  • katib-config: defines the allowed Trial resources, metrics collector, suggestion, and early stopping images.
  • trial-templates: provides example default Job-based Trial templates. An actual Experiment can declare its own template.
  • katib-webhook-cert: provides the TLS certificate for the Experiment validation/defaulting and Pod mutation webhooks.
  • katib-mysql: an ExternalName Service that keeps the application hostname while pointing to the shared Percona MySQL writer endpoint.
  • katib-mysql-secrets: a namespace-local Secret that provides DB_USER and DB_PASSWORD to katib-db-manager.

Operational boundary and verification criteria

Section titled “Operational boundary and verification criteria”

The Katib control plane manages the Experiment and Trial lifecycle, but the Trial container image, dataset access, GPU quota, network access, and output model registration are determined by the Experiment’s trial template and the Profile namespace policy. In particular, a Trial does not automatically receive SeaweedFS artifact credentials or Notebook PVCs. The required Secrets, ServiceAccount, and volume mounts must be specified in the Trial template. Katib manages the experiment lifecycle, not the full environment lifecycle, and it does not synchronize serving registration.

After switching to shared MySQL, verify the following lifecycle on the actual cluster.

  • Experiment creation and webhook defaulting/validation succeed in a Profile namespace.
  • The algorithm Pod creates Suggestions, and a Trial Job or TrainJob is created.
  • The metrics collector is injected into the Trial Pod, and the objective metric is recorded in the katib database.
  • The Experiment and Trial can be viewed in the Katib UI with that user’s permissions.
  • Previous Experiment and Trial results are preserved even after katib-db-manager and the MySQL Pod are restarted.
  • If PBT is used, RWX PVC provisioning and the algorithm Pod mount succeed.

Katib is the HPO search layer for Kubeflow, not the training engine itself. In this repository it is wired for multi-user namespaces, shared MySQL persistence, webhook-based validation and metric collection, and Dashboard access. When it is healthy, users can express search intent declaratively and let Katib drive repeated training workloads until the best result emerges.