tilt icon indicating copy to clipboard operation
tilt copied to clipboard

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

Open glennpow opened this issue 2 months ago • 1 comments

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?

glennpow avatar Oct 17 '25 03:10 glennpow

Possible duplicate of #6581. I posted a solution there that might help.

lachieh avatar Nov 06 '25 17:11 lachieh