Katib UI and namespace isolation validation
Scenario 6. Launching Katib via the UI
Goal
Verify that as a user, you can from the MLOps Studio UI:
create a Katib experiment,
view its status,
view trials that finish successfully.
Prerequisites
Let us assume the experiment name is mnist-katib-ui-quick. If it already exists in this namespace, change it, for example to mnist-katib-ui-quick-2.
Steps
Set your namespace.
Log in to the MLOps Studio Central Dashboard.
In the upper right corner, or wherever you have the namespace selection, set your namespace.
Go to Katib.
In the left menu, find an item like Katib / Experiments / HP Tuning, depending on the version.
Click it. A list of Katib experiments for your namespace should appear. It may be empty or already have something.
Create a new experiment from YAML.
Click + New Experiment / Create Experiment.
If a form opens, switch to the YAML tab, for example YAML, Advanced, or Manual.
Paste the YAML of your working experiment and pay attention to the namespace.
apiVersion: kubeflow.org/v1beta1 kind: Experiment metadata: name: mnist-katib-ui-quick namespace: <namespace_name> spec: maxTrialCount: 2 maxFailedTrialCount: 1 parallelTrialCount: 2 objective: type: minimize goal: 0.01 objectiveMetricName: loss algorithm: algorithmName: random parameters: - name: learning_rate parameterType: double feasibleSpace: min: "0.01" max: "0.05" - name: batch_size parameterType: int feasibleSpace: min: "80" max: "100" trialTemplate: primaryContainerName: tensorflow trialParameters: - name: learningRate description: Learning rate for the training model reference: learning_rate - name: batchSize description: Batch size for the model reference: batch_size trialSpec: apiVersion: kubeflow.org/v1 kind: TFJob spec: tfReplicaSpecs: Chief: replicas: 1 restartPolicy: OnFailure template: metadata: annotations: sidecar.istio.io/inject: "false" spec: containers: - name: tensorflow image: docker.io/liuhougangxa/tf-estimator-mnist command: - python - /opt/model.py - --tf-train-steps=50 - --tf-learning-rate=${trialParameters.learningRate} - --tf-batch-size=${trialParameters.batchSize} Worker: replicas: 1 restartPolicy: OnFailure template: metadata: annotations: sidecar.istio.io/inject: "false" spec: containers: - name: tensorflow image: docker.io/liuhougangxa/tf-estimator-mnist command: - python - /opt/model.py - --tf-train-steps=50 - --tf-learning-rate=${trialParameters.learningRate} - --tf-batch-size=${trialParameters.batchSize}
Click Create / Submit.
Result
The experiment passes and has a Succeeded status.
Scenario 7. Attempt to create a Katib experiment in a foreign namespace via the UI
Goal
Verify that a user working in their namespace is not able to create a Katib experiment in another namespace, in this case qa, even if they manually set metadata.namespace: qa in the YAML section in the UI. The system should ignore the attempt to change the namespace and still create the experiment only in their namespace.
Steps
Set your namespace.
Log in to the MLOps Studio Central Dashboard.
In the upper right corner, or wherever you have the namespace selection, set your namespace.
Check that you do not have access to the qa namespace.
In the left menu, go to Katib / Experiments / HP Tuning, as in the happy path.
Create a new experiment, but with the qa namespace in YAML.
Click + New Experiment / Create Experiment.
Switch to the YAML tab.
Paste the following manifest and pay attention to the namespace qa:
apiVersion: kubeflow.org/v1beta1 kind: Experiment metadata: name: mnist-katib-ui-quick-forbidden namespace: qa spec: maxTrialCount: 2 maxFailedTrialCount: 1 parallelTrialCount: 2 objective: type: minimize goal: 0.01 objectiveMetricName: loss algorithm: algorithmName: random parameters: - name: learning_rate parameterType: double feasibleSpace: min: "0.01" max: "0.05" - name: batch_size parameterType: int feasibleSpace: min: "80" max: "100" trialTemplate: primaryContainerName: tensorflow trialParameters: - name: learningRate description: Learning rate for the training model reference: learning_rate - name: batchSize description: Batch size for the model reference: batch_size trialSpec: apiVersion: kubeflow.org/v1 kind: TFJob spec: tfReplicaSpecs: Chief: replicas: 1 restartPolicy: OnFailure template: metadata: annotations: sidecar.istio.io/inject: "false" spec: containers: - name: tensorflow image: docker.io/liuhougangxa/tf-estimator-mnist command: - python - /opt/model.py - --tf-train-steps=50 - --tf-learning-rate=${trialParameters.learningRate} - --tf-batch-size=${trialParameters.batchSize} Worker: replicas: 1 restartPolicy: OnFailure template: metadata: annotations: sidecar.istio.io/inject: "false" spec: containers: - name: tensorflow image: docker.io/liuhougangxa/tf-estimator-mnist command: - python - /opt/model.py - --tf-train-steps=50 - --tf-learning-rate=${trialParameters.learningRate} - --tf-batch-size=${trialParameters.batchSize}
Click Create / Submit.
After creation:
go to the details of the mnist-katib-ui-quick-forbidden experiment,
open the YAML tab and check the field:
metadata: namespace: <namespace_name>
From the console, check:
kubectl -n qa get experiments kubectl -n <namespace_name> get experiments
Results
In the experiment’s YAML tab you see:
metadata: namespace: <namespace_name>
This means the UI or API ignored the namespace: qa entered in the form and enforced the namespace consistent with the context.
In the qa namespace:
kubectl -n qa get experiments
as a result, there is no mnist-katib-ui-quick-forbidden experiment.
In your namespace:
kubectl -n <namespace_name> get experiments
The experiment runs and finishes successfully.