nice-baker-83329
10/17/2025, 8:18 AM@task(
pod_template_name="a_pod_template",
)
def t1() -> int:
...
show me an example implementation on how can I achieve that and what values should I use in my helm chartancient-wolf-19325
10/17/2025, 8:18 AMpod_template_name.
4. Configure Flyte Helm values to ensure PodTemplates are loaded and available.
Example PodTemplate YAML:
apiVersion: v1
kind: PodTemplate
metadata:
name: a-pod-template
namespace: flyte # Or your project-domain namespace
template:
spec:
containers:
- name: default
env:
- name: MY_ENV_VAR
value: "my_value"
image: docker.io/rwgrim/docker-noop # Placeholder, will be overridden by Flyte
Apply this with:
kubectl apply -f a-pod-template.yaml
Task Example:
from flytekit import task
@task(pod_template_name="a-pod-template")
def t1() -> int:
...
Helm Chart Values:
In your values.yaml (or via --set), ensure the K8s plugin is configured to watch for PodTemplates:
plugins:
k8s:
inject-finalizer: true
# Optionally set a default pod template name if you want all pods to use it by default
# default-pod-template-name: "a-pod-template"
No further changes are needed if you reference the pod template by name in your task.
Note: The PodTemplate must exist in the namespace where the workflow runs, or in the Flyte control namespace as a fallback. The container name in the PodTemplate should be default or primary as per Flyte conventions.
Would you like a step-by-step walkthrough or troubleshooting tips?
Sources:
- Pod templates | Union.ai Docs
- PodTemplate evaluation order
- PodTemplate in task decorator discussion ๐ 0 button ๐ 0 button ๐ก Hint: Mention @runllm in the thread for followups.nice-baker-83329
10/20/2025, 2:29 PMancient-wolf-19325
10/20/2025, 2:29 PMretries, requests, or limits directly in the PodTemplate. PodTemplates are strictly for Kubernetes pod-level configuration (e.g., env vars, volumes, labels, annotations), not Flyte task-level settings. Task attributes such as retries and resource requests/limits must be set in the task decorator or via Flyte's resource configuration mechanisms, not in the PodTemplate itself.
According to the Pod templates documentation, PodTemplates configure pod metadata, environment variables, and pod specs, but Flyte-specific task attributes like retries and resources are set separately in the task definition or with .with_overrides. This separation is also discussed in GitHub Issue #3123.
Would you like more detail on how to set these attributes in your Flyte tasks?
Sources:
- GitHub Issue #3123: Add PodTemplate configuration to flytekit task definitions
- Pod templates documentation ๐ 0 button ๐ 0 button ๐ก Hint: Mention @runllm in the thread for followups.nice-baker-83329
10/21/2025, 10:22 AMancient-wolf-19325
10/21/2025, 10:22 AMcontainer_image or image), not via an environment variable or PodTemplate.
Would you like more detail on how to set the image for your tasks?
Sources:
- GitHub Issue #3624: specifying image in PodTemplate does not set the image used for a NotebookTask
- Pod templates documentation ๐ 0 button ๐ 0 button ๐ก Hint: Mention @runllm in the thread for followups.nice-baker-83329
10/21/2025, 10:24 AMancient-wolf-19325
10/21/2025, 10:24 AMconfig.yaml) under the images section, mapping a name (like default) to your desired image URI. Flyte will use this image for all tasks in the project unless overridden at the task level. For example:
images:
default: ghcr.io/myorg/myimage:latest
You can also specify the image in the TaskEnvironment or task decorator, but the project-level config is the standard way for a default. See Container images documentation for details.
Would you like more detail or an example for a specific Flyte version?
Sources:
- Container images documentation ๐ 0 button ๐ 0 button ๐ก Hint: Mention @runllm in the thread for followups.