training-operator icon indicating copy to clipboard operation
training-operator copied to clipboard

RBAC problem - possibility to disable Istio?

Open matiaschaud opened this issue 1 year ago • 2 comments

What happened?

I'm running the quickstart example, if I set he number of nodes as1, it works.

But if I start the TrainJob process with 2 nodes:

# 1. Launch the job - it will fail, but the parent resource is created
job_id = TrainerClient().train(
    trainer=CustomTrainer(
        func=train_pytorch,
        num_nodes=2,
        resources_per_node={
            "cpu": 5,
            "memory": "16Gi",
            # "gpu": 1
        },
    ),
    runtime=TrainerClient().get_runtime("torch-distributed"),
)

The 2 process start but I get this error:

Image

I read in the V1 trainer documentation if istio is installed, disable the sidecar injection is needed: https://www.kubeflow.org/docs/components/trainer/legacy-v1/user-guides/tensorflow/#what-is-tfjob

Important note:

  1. I'm using kubeflow platform
  2. I'm launching the process using the Kubeflow notebooks in the kubeflow-user-example-com namespace

Could you help me to understand if it's a bug or if I'm doing something bad.

Thanks.

What did you expect to happen?

Solve the rbac issue

Environment

Kubernetes version:

$ kubectl version

Client Version: v1.33.3
Kustomize Version: v5.6.0
Server Version: v1.33.4

Kubeflow Trainer version:

$ kubectl get pods -n kubeflow-system -l app.kubernetes.io/name=kubeflow-trainer -o jsonpath="{.items[*].spec.containers[*].image}"

This command didn't return nothing but I installed the kubeflow platform 1.10.1

Kubeflow Python SDK version:

$ pip show kubeflow

Name: kubeflow
Version: 0.1.0
Summary: Kubeflow Python SDK to manage ML workloads and to interact with Kubeflow APIs.
Home-page: https://github.com/kubeflow/sdk
Author: 
Author-email: The Kubeflow Authors <[email protected]>
License-Expression: Apache-2.0
Location: /opt/conda/envs/movie-recommender-env/lib/python3.11/site-packages
Requires: kubeflow-trainer-api, kubernetes, pydantic
Required-by: 

Impacted by this bug?

Give it a 👍 We prioritize the issues with most 👍

matiaschaud avatar Oct 02 '25 00:10 matiaschaud

Thanks for creating this @matiaschaud! Yes, you should disable Istio to make sure your distributed nodes can communicate between each other. We are working towards giving ability to set labels via SDK: https://github.com/kubeflow/sdk/pull/91

As a workaround, you should manually patch the torch-distributed runtime, to add labels to the Pod template metadata: https://github.com/kubeflow/trainer/blob/master/manifests/base/runtimes/torch_distributed.yaml#L21

/remove-label lifecycle/needs-triage /area enterprise_readiness

andreyvelich avatar Oct 02 '25 20:10 andreyvelich

It works!!

Also if great if the annotation could be added from the sdk in the future!

Thanks a lot.

My torch-distributed manifest:

apiVersion: trainer.kubeflow.org/v1alpha1
kind: ClusterTrainingRuntime
metadata:
  name: torch-distributed
  labels:
    trainer.kubeflow.org/framework: torch
spec:
  mlPolicy:
    numNodes: 1
    torch:
      numProcPerNode: auto
  template:
    spec:
      replicatedJobs:
        - name: node
          template:
            metadata:
              labels:
                trainer.kubeflow.org/trainjob-ancestor-step: trainer
            spec:
              template:
                metadata:
                  annotations:
                    sidecar.istio.io/inject: "false"
                spec:
                  containers:
                    - name: node
                      image: pytorch/pytorch:2.7.1-cuda12.8-cudnn9-runtime

matiaschaud avatar Oct 03 '25 19:10 matiaschaud