Skip to content

Port forwarding to specific pod in helm workload that contains multiple pods #6622

Description

@glennpow

I'm trying to use the langfuse helm chart in my Tiltfile and, although it launches appropriately, I'm having trouble forwarding the port to the web pod specifically. I use k8s_resource to refer to the workload and use extra_pod_selectors to select the specific pod, but it always ends up selecting a random pod to forward the port to.

Here is the first part that applies the helm chart:

helm_repo("langfuse-repo", "https://langfuse.github.io/langfuse-k8s", labels=["langfuse"])
helm_resource(
  "langfuse",
  "langfuse-repo/langfuse",
  resource_deps=["langfuse-repo"],
  namespace="langfuse",
  labels=["langfuse"],
  deps=["configurations/langfuse.yaml"],
  flags=[
      "--create-namespace",
      "--values=configurations/langfuse.yaml",
  ],
)

I can see that one pod should be selectable by the following label:

> kubectl get pods -l app=web -n langfuse
NAME                            READY   STATUS    RESTARTS   AGE
langfuse-web-5897965c8c-drwcn   1/1     Running   0          4h37m

So I add this after the helm_resource call:

k8s_resource(
    "langfuse",
    port_forwards=3000,
    extra_pod_selectors=[{"app": "web"}],
    labels=["langfuse"],
)

This does then create a PortForward in tilt, but it will randomly apply it to one of the pods created by the langfuse helm chart. I.e. clickhouse or worker or zookeeper:

> tilt get PortForward
NAME                                             CREATED AT
langfuse-langfuse-clickhouse-shard0-0            2025-10-17T02:41:07Z

What am I doing wrong to properly select the single web pod when applying the port forward?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions