flyte icon indicating copy to clipboard operation
flyte copied to clipboard

[V2] Support tasks pods scheduled in separate k8s namespace

Open popojk opened this issue 2 months ago • 5 comments

Issue

In v1, the tasks will be scheduled in separate namespace with name <project>-<domain>. We can do the same in v2 runtime

What's expected

  1. When the user created a run, the BE should check if the <project>-<domain> namespace existed. If not, create one.
  2. Our secret manager inject secret into task pods with k8s ENV reference, so that the secret value will not shown in the pod spec. However, one limitation is that the task pod must be in the same namespace in order to read that secret value. Once we support multi namespace/cluster, we will have to find a way to solve this issue. Maybe we could have a separate background service that sync the secrets in parent namespace to child namespaces. This is an open question.

popojk avatar Sep 17 '26 05:09 popojk

It seems likely that Flyte v2 supports scheduling task pods in separate Kubernetes namespaces using a namespace mapping template, typically <project>-<domain>. This mapping is controlled by the namespace_mapping.template value in your Helm configuration, and the system will create the namespace if it does not exist when a run is created. All relevant Flyte components (clusterresourcesync, propeller, operator, executor, flyteadmin) use this mapping to resolve the target namespace for task execution. See the details in namespace mapping documentation.

Regarding secrets, Flyte's secret injection relies on Kubernetes secrets being present in the same namespace as the task pod. If you use multiple namespaces, you must ensure secrets are synced to each relevant namespace, as Flyte does not natively sync secrets across namespaces. The documentation suggests this is a known limitation and hints at the need for a background service or manual process to synchronize secrets between namespaces (source). Would you like more detail on how to implement secret synchronization or namespace management?

Sources:


This is an AI-generated response and your feedback is appreciated! Please leave a 👍 if this is helpful and 👎 if it is not.

Mention @herald to ask follow-up questions. See runllm.com for more!

runllm avatar Sep 17 '26 05:09 runllm

@Sovietaced are there any updates on the topic? Or if not, would there be the option to contribute to fixing this?

sr425 avatar Oct 15 '26 05:10 sr425

@Sovietaced are there any updates on the topic? Or if not, would there be the option to contribute to fixing this?

Go for it

Sovietaced avatar Oct 15 '26 06:10 Sovietaced

Hi, I took a look at implementing this. Initially trying to scope pod lists to project namespace https://github.com/flyteorg/flyte/pull/8215. Let me know if the PR makes sense 🙏

madiyar-wayve avatar Oct 22 '26 10:10 madiyar-wayve

Hi, I think the 8226 fixes exactly my issue, hope it can be merged soon :-)

sr425 avatar Nov 12 '26 18:11 sr425