elegant-sandwich-48375
02/13/2026, 9:18 AMancient-wolf-19325
02/13/2026, 9:18 AMcontainers list in your V1PodSpec. All containers listed in containers will run in parallel within the pod, while those in init_containers run sequentially before the main containers start. For example, to add a sidecar or secondary container, simply append another V1Container to the containers list, not `init_containers`—see the Flyte pod template documentation and example with multiple containers.
Here's a minimal example:
from kubernetes.client import V1Container, V1PodSpec
pod_spec = V1PodSpec(
containers=[
V1Container(name="primary", image="your-primary-image"),
V1Container(name="sidecar", image="your-sidecar-image"),
],
# ... other pod spec fields ...
)
Would you like a step-by-step breakdown or a full Flyte task example?
Sources:
- Flyte pod template documentation
- Example with multiple containers 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.acoustic-parrot-22802
02/13/2026, 9:20 AMancient-wolf-19325
02/13/2026, 9:20 AMV1Container to the containers list in your dynamic_pod_spec_sv function. For example, to add a sidecar container named `"sidecar"`:
from kubernetes.client import V1Container, V1PodSpec, V1ResourceRequirements, V1VolumeMount, V1LocalObjectReference, V1SecurityContext, V1Volume, V1PersistentVolumeClaimVolumeSource, V1SecretVolumeSource
def dynamic_pod_spec_sv(claim_name: str, guid: str, network_topology: str) -> V1PodSpec:
pod_spec = V1PodSpec(
image_pull_secrets=[V1LocalObjectReference(name="te13535-artifactory-cred")],
node_selector=RecomputeConfig.NODE_SELECTOR,
host_ipc=True,
restart_policy="OnFailure",
service_account=RecomputeConfig.SERVICE_ACCOUNT,
service_account_name=RecomputeConfig.SERVICE_ACCOUNT,
containers=[
V1Container(
name="sessionvalidator",
image=RecomputeConfig.SESSION_VALIDATOR_IMAGE,
image_pull_policy="Always",
security_context=V1SecurityContext(privileged=True),
resources=V1ResourceRequirements(requests={"cpu": "10", "memory": "10Gi"}),
volume_mounts=[V1VolumeMount(name="gcs-volume", mount_path=RecomputeConfig.GCS_FOLDER)],
),
V1Container(
name="sidecar",
image="alpine",
command=["/bin/sh"],
args=["-c", "echo sidecar running; sleep 1000"],
resources=V1ResourceRequirements(requests={"cpu": "1", "memory": "100Mi"}),
volume_mounts=[V1VolumeMount(name="gcs-volume", mount_path=RecomputeConfig.GCS_FOLDER)],
),
],
init_containers=[
V1Container(
name="drivedata",
image=RecomputeConfig.GCP_INIT_IMAGE,
image_pull_policy="Always",
command=["/bin/sh", "-c"],
args=["sleep 100"],
resources=V1ResourceRequirements(requests={"cpu": "10", "memory": "40Gi"}),
volume_mounts=[V1VolumeMount(name="gcs-volume", mount_path=RecomputeConfig.GCS_FOLDER)],
),
],
volumes=[
V1Volume(
name="gcs-volume",
persistent_volume_claim=V1PersistentVolumeClaimVolumeSource(claim_name=claim_name),
),
V1Volume(
name="gitlab-secrets",
secret=V1SecretVolumeSource(secret_name=RecomputeConfig.GITLAB_CERTIFICATES),
),
V1Volume(
name="gitlab-token-secret",
secret=V1SecretVolumeSource(secret_name=RecomputeConfig.GITLAB_TOKEN),
),
],
)
return pod_specancient-wolf-19325
02/13/2026, 9:21 AM"sessionvalidator" and "sidecar" containers in the same pod, as shown in Flyte's multiple containers example.
Sources:
- Example with multiple containers 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.acoustic-parrot-22802
02/13/2026, 9:40 AMancient-wolf-19325
02/13/2026, 9:40 AMkubectl describe pod <pod-name> for specific errors, such as "Insufficient CPU/Memory" or "ImagePullBackOff" (Flyte pod template docs).
Would you like step-by-step troubleshooting instructions for diagnosing the queued state?
Sources:
- Flyte pod template docs 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.acoustic-parrot-22802
02/13/2026, 9:41 AMancient-wolf-19325
02/13/2026, 9:41 AMprimary_container_name, image issues, or unsupported pod spec fields. Flyte requires the primary_container_name in the pod template to match a container in the containers list, and the primary container must be present and correctly configured (Flyte pod template docs).
Check that:
- The primary_container_name exactly matches one of the container names in containers.
- All required fields (like images) are set and valid.
- No unsupported or misspelled fields are present.
Would you like a checklist or example for verifying your pod spec?
Sources:
- https://github.com/flyteorg/flyte/blob/master/flyteplugins/go/tasks/plugins/k8s/pod/plugin.go 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.acoustic-parrot-22802
02/14/2026, 12:51 PMancient-wolf-19325
02/14/2026, 12:51 PM