From 2a5ef229e2e0e98883cb892a5672bc74243ac81f Mon Sep 17 00:00:00 2001 From: Du Xinmin <2812493086@qq.com> Date: Mon, 27 Jan 2025 02:18:49 +0800 Subject: [PATCH] Update user guide for namespace label in Katib Python SDK example (#3976) * doc(katib): add guidance of namespace label configuration in Getting-Started Signed-off-by: Xinmin Du <2812493086@qq.com> * doc(katib): move guidance to Metrics Collector, add note in getting-start Signed-off-by: Xinmin Du <2812493086@qq.com> * Update content/en/docs/components/katib/user-guides/metrics-collector.md Co-authored-by: Shao Wang <77665902+Electronic-Waste@users.noreply.github.com> Signed-off-by: Du Xinmin <2812493086@qq.com> --------- Signed-off-by: Xinmin Du <2812493086@qq.com> Signed-off-by: Du Xinmin <2812493086@qq.com> Co-authored-by: Shao Wang <77665902+Electronic-Waste@users.noreply.github.com> --- .../docs/components/katib/getting-started.md | 5 ++++ .../katib/user-guides/metrics-collector.md | 24 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/content/en/docs/components/katib/getting-started.md b/content/en/docs/components/katib/getting-started.md index ee8f082e75..dfcd76dcec 100644 --- a/content/en/docs/components/katib/getting-started.md +++ b/content/en/docs/components/katib/getting-started.md @@ -39,6 +39,11 @@ If you install Katib as part of Kubeflow Platform, you can open a new **Note**. If you use Katib within Kubeflow Platform to run this example, you need to use this namespace: `KatibClient(namespace="kubeflow-user-example-com")`. +**Note**. The `kubeflow` namespace is pre-configured with the required label +`katib.kubeflow.org/metrics-collector-injection: enabled` for metrics collection. If you want to use pull-based metrics collector +in other namespaces, you can attach this label following the instructions in the +[Metrics Collector](/docs/components/katib/user-guides/metrics-collector/#prerequisites). + ```python # [1] Create an objective function. def objective(parameters): diff --git a/content/en/docs/components/katib/user-guides/metrics-collector.md b/content/en/docs/components/katib/user-guides/metrics-collector.md index 9e59f41fae..92d15f943a 100644 --- a/content/en/docs/components/katib/user-guides/metrics-collector.md +++ b/content/en/docs/components/katib/user-guides/metrics-collector.md @@ -6,6 +6,30 @@ weight = 40 This guide describes how Katib metrics collector works. +## Prerequisites + +Before running your hyperparameter tuning Katib Experiment with Python SDK, +ensure the namespace label `katib.kubeflow.org/metrics-collector-injection: enabled` +is present. This label enables the sidecar container injection for pull-based metrics collectors to collect metrics during the experiment. + +You can configure the namespace by adding the following label `katib.kubeflow.org/metrics-collector-injection: enabled` +as is shown in the sample code: + +```yaml +apiVersion: v1 +kind: Namespace +metadata: + name: + labels: + katib.kubeflow.org/metrics-collector-injection: enabled +``` + +Or you can add the label to an existing namespace using the following command: + +```bash +kubectl label namespace katib.kubeflow.org/metrics-collector-injection=enabled +``` + ## Overview There are two ways to collect metrics: