Willow Tunnels
A Willow Tunnel is an outbound connection between the run service in your hybrid deployment and Willow's hosted gateway.
Use it when run can make outbound HTTPS connections and you cannot or prefer not to expose it to inbound traffic. The tunnel does not require a public hostname, TLS certificate, ingress controller, or inbound firewall rule for run.
This also fits clusters without an ingress controller or load balancer, including development clusters such as kind or k3s on a laptop, as long as they have outbound connectivity.
Your run service opens long-lived outbound WebSocket connections to Willow. MCP clients keep using your organization's normal MCP URL, https://<org>.withwillow.ai/mcp. Willow relays calls for MCP servers on the tunnel gateway over those connections, and run executes them inside your network.
The connector is built into run, connects to Willow's own gateway, and uses the gateway's existing AUTH_SECRET. No separate tunnel service, agent, or third-party account is required. It needs outbound HTTPS access on port 443. For installation, go to Setup; the following sections explain the components and connection lifecycle.
Tunnels are a SaaS feature managed from Settings > Gateway Settings > Add Gateway > Willow Tunnel. They are not relevant to a full on-prem deployment, where Willow already runs inside your network.
Components
| Component | Where it runs | Owned by | What it does |
|---|---|---|---|
| Tunnel gateway | Willow | Willow | An External Run Service gateway with a Tunnel badge. Willow mints its id, its run service URL (https://<org host>/mcp/tunnel/<id>) and its AUTH_SECRET; you never type a URL. Pin MCP servers to it, or make it the default gateway, like any other gateway. MCP clients never see its URL: connection instructions keep showing your organization's MCP URL. |
| Tunnel endpoint | Willow's hosted run | Willow | Terminates the WebSockets at wss://<org host>/mcp/tunnel/_connect, authenticates each connector by AUTH_SECRET, and relays requests for the gateway over them. Spreads requests round-robin over every attached socket and skips one that is gone. Scales horizontally; a request landing on a Willow replica that does not hold the chosen socket is handed to the one that does. |
| Connector | Inside your network, inside the run process | You run it; Willow issues its secret | Starts automatically when run boots with a tunnel-shaped BASE_URL. Dials out over HTTPS (port 443) with two sockets by default, authenticates with AUTH_SECRET, and serves each relayed request against its own local HTTP listener. Redials any socket that drops. Never listens on an external port. |
| Credential | Your secret store | Shared | The gateway AUTH_SECRET. It is what the connector presents to Willow, what Willow presents to your run for service-to-service calls, and what run uses to call the SaaS db-service. One secret, shown once. |
Connection model
┌──────────────────────────────────────────────┐
│ Willow SaaS │
│ │
│ MCP clients ──▶ <org>.withwillow.ai/mcp │
│ (hosted run: auth, tool │
│ list, routing) │
│ │ tool calls for MCP │
│ │ servers on the │
│ Willow app ──┐ │ tunnel gateway │
│ db-service ──┴───────▼ │
│ hosted run: tunnel endpoint │
│ (holds the WebSockets) │
└──────────────────────────────┬───────────────┘
│ wss://<org>.withwillow.ai/mcp/tunnel/_connect
│ opened BY your run, outbound only,
│ authenticated with AUTH_SECRET
│
┌──────────────────────────────┴───────────────┐
│ Your network │
│ │
│ run (hybrid) ── executes relayed calls │
│ against 127.0.0.1:PORT │
│ │ │
│ └──▶ db-service via connect │
│ (ordinary outbound HTTPS, │
│ unchanged from hybrid) │
└──────────────────────────────────────────────┘
Three things to notice:
- Every connection is outbound from your side. The tunnel sockets, and
run's own calls to the SaaS db-service, both leave your network over 443. Nothing is accepted from the internet. - MCP clients don't change. They connect to your organization's MCP URL,
https://<org>.withwillow.ai/mcp, as they would without a tunnel. One connection can mix MCP servers on Willow-hosted gateways with MCP servers on the tunnel: each tool call is routed to the gateway its MCP server is assigned to. The tunnel URL is only yourrun'sBASE_URL. - Your run still does the work. For a tool call on the tunnel gateway, your
runchecks the caller's token, decrypts credentials, applies guards and approvals, calls the MCP server, and writes the audit log, exactly as it does behind an ingress. The tunnel is transport, not trust.
What happens on a tool call
- A client calls a tool through
https://<org>.withwillow.ai/mcp. Willow's hostedrunauthenticates the client and finds the gateway the tool's MCP server is assigned to: its own gateway setting, or else the organization's default. - If that gateway is a tunnel, the hosted
runrelays the call to yourrun's/callendpoint over the tunnel, forwarding the client's Willow access token. Calls for MCP servers on Willow-hosted gateways are served by Willow as usual. - Willow picks one of the gateway's attached sockets, round-robin over every socket from every
runreplica you run. If the chosen socket is gone, or the Willow replica holding it is unreachable, it tries the next one. It only does that while the call provably never reached yourrun, so a tool never runs twice. If no connector is attached, the client gets aTUNNEL_NOT_CONNECTEDtool error immediately; nothing is queued. - Your
runreplays the request against its own listener (127.0.0.1:PORT) and runs the tool. - The result comes back over the same socket. Your
runhas 290 seconds to answer; after that the call fails with a timeout. - If the socket drops before your
runanswers, the call fails with a tunnel error rather than hanging. Willow does not retry it, because the tool may already have run.
tools/list is answered by Willow from the tool catalog it has stored for each MCP server, so listing tools does not depend on the tunnel. The universal URL, https://mcp.withwillow.ai/mcp, works the same way.
Willow itself reaches your run through the tunnel URL for dashboard features: tool tests, discovery, guard evaluation and health checks.
Connection lifecycle
- Start. The connector starts once
runis already listening, so the first relayed request has somewhere to land. It runs only on a single-organizationrun(the chart always setsORGfromglobal.org) that has anAUTH_SECRET. If either is missing,runstarts normally but never dials out, and logs nothing about the tunnel. - Keepalive. Willow pings the connector every 30 seconds and drops the connection if a ping goes unanswered for 10 seconds. The connector, in turn, reconnects if it hears nothing from Willow for 90 seconds, which catches sockets a middlebox has silently killed.
- Several sockets per replica. Each
runreplica keeps two sockets open by default (TUNNEL_CONNECTIONS, 1–8). Each socket redials on its own, so while one reconnects the other keeps serving, and the two usually land on different Willow replicas. - Reconnects. After a drop, a socket redials with exponential backoff, from 1 second up to a 30-second ceiling, with jitter. If Willow rejects the secret (HTTP 401 or 403), it waits 60 seconds between attempts instead, so a bad secret does not flood either side's logs.
- Willow restarts. When a Willow replica shuts down, it closes the sockets it holds and stops accepting new ones, so your connectors redial straight away and land on a replica that stays up. The other socket on each of your replicas carries traffic in the meantime.
- Shutdown. On
SIGTERM,runcloses its sockets before it stops its HTTP listener, so Willow stops routing to that pod first. Requests still in flight on that pod are cut, as described in step 6 above. - Multiple replicas. Each
runreplica opens its own sockets to the same gateway, and Willow spreads requests round-robin over all of them, so each replica takes an even share. A replica that goes away drops out of the rotation as soon as its sockets close. A rolling update with two or more replicas therefore keeps the gateway reachable throughout. - Version reporting. On connect, the connector tells Willow its
runversion (from theGIT_TAGorGIT_COMMIT_SHAbaked into the image) and its pod hostname. Willow records both against the connection, which tells support which build is attached without access to your cluster. You do not set these variables yourself.
Setup
The flow mirrors hybrid Phases 2–4 with Phase 1 removed. Budget about fifteen minutes.
Step 1: Create the tunnel gateway
Owner: Willow org admin (needs org:edit) · Produces: the gateway URL and the AUTH_SECRET
- Open the admin app, Settings > Gateway Settings.
- Click Add Gateway and choose Willow Tunnel. There is no URL field; Willow generates one on your organization's gateway domain.
- Click Add Gateway. A Gateway Auth Secret dialog appears with a one-time secret and a Next steps box listing the two values your
runneeds:BASE_URL(the generated tunnel URL) andAUTH_SECRET. Copy both now, because the secret is not shown again. - The new card shows a Tunnel badge and a health badge reading Connector not attached. That is expected until Step 3.
If the dialog is gone and you lost the secret, use Rotate Secret on the card to mint a new one. The tunnel URL is always visible on the card's Run service BASE_URL: line. The card's Run: line shows the MCP URL clients use, which is your organization's normal one.
Step 2: Create values.yaml and the secret
Owner: Platform engineer · Needs: Step 1 · Produces: the config Helm installs
Start from the hybrid guide's Step 6 values and make three changes: turn the run ingress off, set BASE_URL to the tunnel URL, and drop the TLS block.
Replace the placeholders:
<ORG_SLUG>: your organization slug<TUNNEL_URL>: theBASE_URLvalue from the Step 1 dialog, e.g.https://<ORG_SLUG>.withwillow.ai/mcp/tunnel/gw_tun_…
global:
domain:
host: "unused.invalid" # nothing is published; the chart still wants a value
org: "<ORG_SLUG>"
OPENAI_API_KEY: ""
deployments:
app:
enabled: false
connect:
enabled: false
db-service:
enabled: false
run:
enabled: true
ingress:
enabled: false # no inbound path; run dials out instead
# The gateway auth secret from Step 1. See the hybrid guide for why it
# must not live in values.yaml.
secretName: "willow-secrets"
env:
PORT: "3000"
LOG_LEVEL: "info"
# The tunnel URL from Step 1. A tunnel-shaped BASE_URL is what tells run
# to open the tunnel on start — no other flag is needed.
BASE_URL: "<TUNNEL_URL>"
DB_SERVICE_URL: "https://<ORG_SLUG>.withwillow.ai/api/on-prem-db-service"
CONNECT_URL: "https://<ORG_SLUG>.withwillow.ai"
As in the hybrid guide, <ORG_SLUG>.withwillow.ai is an example. Willow minted the tunnel URL on your organization's Connect host, which may be region-specific (<ORG_SLUG>.eu.withwillow.ai) or a custom domain. Copy the host from the tunnel card's Run service BASE_URL: line into DB_SERVICE_URL and CONNECT_URL as well, so all three use the same host. The tunnel card itself has no Connect: line, because it is an external gateway.
Create the namespace and the secret. Keep the single quotes:
kubectl create namespace <namespace> --dry-run=client -o yaml | kubectl apply -f -
kubectl create secret generic willow-secrets \
--namespace <namespace> \
--from-literal=AUTH_SECRET='<gateway-secret-from-step-1>'
Verify the rendered BASE_URL is your tunnel URL and no Ingress is produced, before installing anything:
helm template willow willow/webrix-helm -f values.yaml \
| grep -E "BASE_URL|CONNECT_URL|DB_SERVICE_URL|kind: Ingress"
The chart normally derives BASE_URL from the ingress host. If the output still shows https://willow.unused.invalid, your chart version does not let env.BASE_URL override the derived value; upgrade the chart, or set the value through extraEnv/a secret, whichever your version supports. The goal is that the run container starts with BASE_URL=<TUNNEL_URL>.
Optional variables
None of these are needed for a standard install; a tunnel-shaped BASE_URL plus AUTH_SECRET is enough.
| Variable | Purpose |
|---|---|
TUNNEL_ENABLED | true (or 1) forces the connector on; false (or 0) forces it off and always wins. Unset, it is inferred from BASE_URL: a URL whose path is /mcp/tunnel/<id> turns it on. |
TUNNEL_URL | The WebSocket endpoint to dial. Default: BASE_URL with its last path segment replaced by _connect, i.e. wss://<org host>/mcp/tunnel/_connect. Set it if you front Willow's domain with something of your own, or if you force the connector on with TUNNEL_ENABLED=true while BASE_URL is not the tunnel URL. In that case the default would point at your own host, not Willow. https:// values are converted to wss://. |
TUNNEL_CONNECTIONS | How many sockets each run replica keeps open to Willow, from 1 to 8. Default: 2. More than one keeps the replica reachable while a socket reconnects. |
HTTPS_PROXY / HTTP_PROXY / NO_PROXY | Upper- or lower-case, honoured for the tunnel connection as for every other outbound call run makes. A NO_PROXY entry exempts the Willow host when it matches exactly, matches as a domain suffix (withwillow.ai or .withwillow.ai), or is *. |
TUNNEL_CREDENTIAL_*, TUNNEL_CLIENT_CERT, TUNNEL_CLIENT_KEY | A short-lived credential sent with the secret. See Connector credential variables. |
GIT_TAG and GIT_COMMIT_SHA are set by the image build and reported to Willow on connect (see Connection lifecycle). Do not override them.
Step 3: Install the chart
Identical to the hybrid guide's Step 7:
helm repo add willow https://charts.withwillow.ai && helm repo update
helm upgrade --install willow willow/webrix-helm \
--namespace <namespace> \
-f values.yaml \
--wait --timeout 5m
Within a few seconds of the pod becoming ready the log shows the connector attach, once per socket:
[tunnel] connector starting; dialing Willow connections=2
[tunnel] connected to Willow; this run is now reachable at the tunnel URL socket=0 gatewayId=gw_tun_… publicUrl=https://<ORG_SLUG>.withwillow.ai/mcp/tunnel/gw_tun_…
[tunnel] connected to Willow; this run is now reachable at the tunnel URL socket=1 gatewayId=gw_tun_… publicUrl=https://<ORG_SLUG>.withwillow.ai/mcp/tunnel/gw_tun_…
Step 4: Verify end to end
-
Gateway card. Back in Gateway Settings, click the re-check arrow on the tunnel card. It should read Healthy. The check asks Willow's tunnel endpoint whether a connector is attached, then calls
/healthzand/healthz/validatethrough the tunnel, so a green badge proves the full path includingAUTH_SECRET. -
The path into your run. From any machine:
curl -sS https://<ORG_SLUG>.withwillow.ai/mcp/tunnel/<id>/.well-known/oauth-protected-resourceAn answer from your
runproves the tunnel delivers requests. Theresourcefield should be your tunnel URL (possibly with a trailing slash, whichrunnormalises). This URL is only for checks like this one; don't give it to MCP clients. -
Assign MCP servers. Make the tunnel the Default Gateway, or pick it in an MCP server's gateway setting. If the tunnel is your only gateway, Willow already made it the default when you created it.
-
An MCP client. Connect Cursor or Claude to your organization's MCP URL,
https://<ORG_SLUG>.withwillow.ai/mcp, as shown in the dashboard's connection instructions, and sign in. Calls to tools on the tunnel's MCP servers now execute inside your cluster; therunlogs and the audit log show them.
In Monitor > Logs, a tunnel call has a cable icon in the Gateway column. Its call flow draws the extra hop: Willow gateway (the host the client called), then a Willow Tunnel edge, then your Run service. The Device column shows the user's own IP address, not Willow's or the tunnel's. If Willow couldn't deliver the call (for example, no connector was connected), Willow writes the row itself and the edge reads not delivered.
Slack background agents
A background agent set to the tunnel gateway runs its tools in your run, including the reply it posts back to Slack. Willow's hosted Slack agent service cannot be reached from your run, so without one of your own the agent receives Slack messages but cannot answer, and its reply tool returns Slack replies are not configured (no Slack agent service URL for this organization, and SLACK_BG_AGENT_URL is unset).
Run slack-background-agent in the same release as the tunnel run and pin those agents to it. It only makes outbound connections (to Slack over Socket Mode and to Willow through /api/on-prem-db-service), so nothing is exposed. Agents on Willow-hosted gateways keep using Willow's Slack service.
-
Register a Slack agent gateway. In Build > Background Agents > settings (gear) > Channels, select Manage on Slack. Under Slack agent gateways, select Add gateway, enter any name and the URL
http://slack-background-agent, then Save gateways. Copy the Gateway ID. Leave Slack agent service URL empty: setting it moves every Slack agent in the organization off Willow's hosted service. -
Add it to
values.yamlnext torun, with the same secret andDB_SERVICE_URL, and re-run Helm. Enabling it also setsSLACK_BG_AGENT_URLonrun, which restarts with the new value.deployments:slack-background-agent:enabled: truegatewayId: "<Gateway ID from step 1>"secretName: "willow-secrets" # same AUTH_SECRET as runenv:DB_SERVICE_URL: "https://<ORG_SLUG>.withwillow.ai/api/on-prem-db-service"LOG_LEVEL: "info" -
Pin each agent and use Socket Mode. In the agent's Settings > Slack, set Slack agent gateway to the gateway from step 1. Your
slack-background-agentopens the Socket Mode connection for pinned apps, so if the app shows HTTP Events API, select Recreate app, choose Socket Mode under Advanced setup, generate an app-level token (scopeconnections:write) in the Slack app's Basic Information > App-Level Tokens, paste it, and select Install to Slack. A recreated app has to be added to its channels again.
Within a minute the slack-background-agent log shows Slack Socket Mode active for the agent, and replies arrive in Slack.
Security model
- Zero inbound. Nothing in your network listens for Willow or for MCP clients. Remove the tunnel gateway in Willow, or stop
run, and the path is gone. - One secret, mutual. The connector proves itself to Willow with
AUTH_SECRET, and Willow proves itself torunon service calls with the same secret. Rotate it from the card like any gateway secret and roll the Kubernetes secret; the connector reconnects with the new value on restart. - The caller's own token. A relayed tool call carries the client's Willow access token (OAuth, or a Willow API token), and your
runvalidates it before doing anything. Willow never sends its own service secret on these calls, and it doesn't relay older user-access-key credentials, which aren't scoped to one organization. Clients that still use them get aTUNNEL_CREDENTIAL_UNSUPPORTEDerror and need to sign in again with OAuth. - Scoped per gateway. A secret only attaches to its own gateway id. Willow also checks that the host a connector dials matches the organization that owns the gateway, so a secret cannot be replayed against another tenant's hostname.
- Transport, not trust. Willow does not decrypt, cache or inspect relayed bodies beyond framing them; it forwards headers with hop-by-hop ones removed and
X-Forwarded-For/Proto/Hostset. Credential decryption, policies, guards, approvals and the audit log all execute on yourrun. - No tunnel-specific allow-listing. Nothing connects into your network, so the hybrid guide's NAT IP table and firewall steps do not apply. The only egress your
runneeds is HTTPS to your Connect host. - Backpressure and limits. Bodies are split into 64 KB frames so one large tool result cannot monopolise the socket. Either side pauses its source once 4 MB is queued on the WebSocket. A single client that falls more than 16 MB behind has its stream dropped rather than buffered further, so one slow client cannot stall every other session on the tunnel. Response headers must arrive within 290 seconds, just under the 5-minute idle limit on Willow's load balancer.
What Willow can see
Willow terminates TLS both for the user's request to https://<org>.withwillow.ai/mcp and for the tunnel socket, because it has to authenticate the user and pick the gateway. Each relayed request and response therefore passes through Willow's hosted run in memory, exactly as a call to a Willow-hosted gateway does, but it is not stored. Willow also records:
- connection metadata for each socket: when it connected, the
runversion, the pod hostname and the Willow replica that holds it - the egress IP address your cluster connects from
- the audit log your
runwrites, as in any hybrid install
To keep MCP server credentials out of Willow's reach as well, use Write-Only KMS.
Shared responsibility
| Willow handles | You handle |
|---|---|
| Authenticating each connector and binding it to one gateway of one organization | Keeping AUTH_SECRET secret, and rotating it |
| Relaying only your organization's calls, for MCP servers assigned to the tunnel, to your tunnel | Network policy for the run pod and for the MCP servers it can reach |
| Authenticating MCP clients before relaying their calls | Credentials and OAuth for each upstream MCP server |
| The TLS certificate on your organization's Willow host | Your egress proxy and any TLS inspection on the path |
| Closing a replica's sockets cleanly on restart so connectors move elsewhere | Upgrading the run image |
| Telling Willow support if you suspect the secret leaked |
Hardening
None of these are required for a working tunnel. Each one narrows what a mistake or a leaked secret can reach.
-
Keep the secret in a secret store. Supply
AUTH_SECRETthroughsecretName(or External Secrets, or a CSI driver), never throughvalues.yaml, and limit who can readwillow-secretswith RBAC. -
Block all ingress to the
runpod. A tunnel needs no inbound connection: the connector replays requests over loopback, which a NetworkPolicy does not affect. If another workload in your cluster callsrundirectly, add aningressrule for it.apiVersion: networking.k8s.io/v1kind: NetworkPolicymetadata:name: run-deny-ingressnamespace: <namespace>spec:podSelector:matchLabels:app: runpolicyTypes:- Ingress -
Restrict egress to what
runcalls. That is HTTPS to your Connect host plus the APIs and MCP servers your tools use. Integrations > ⋮ > Export Egress Allowlist lists those hosts (Egress allowlist). -
Don't TLS-inspect the tunnel. A proxy that inspects TLS sees every relayed request and response. Exempt your Connect host from inspection. If your policy requires inspection, add the proxy's CA with
global.caCertificate(TLS / custom CA). -
Restrict where users can call from. Turn on the IP access filter with your office or VPN ranges. Your
runapplies it to the user's own address, not to Willow's. -
Keep credentials away from Willow. Configure Write-Only KMS on the tunnel gateway.
-
Rotate on a schedule. Use Rotate Secret on the card, update
willow-secrets, thenkubectl rollout restart deploy/run -n <namespace>. -
Pin the image. Upgrade
rundeliberately rather than on every restart (Pin your images). -
Require a short-lived credential. Bind the connector to a Kubernetes service account or a client certificate from your CA, so the secret alone is not enough (Short-lived connector credentials).
If the secret leaks
Anyone holding AUTH_SECRET can attach a connector to your tunnel gateway and receive the calls Willow relays to it. Treat it like a private key.
- Select Rotate Secret on the tunnel card. New sockets with the old secret are refused from then on.
- Update
willow-secretswith the new value and restartrun, so your own sockets reconnect with it. - Contact Willow support. Willow checks the secret when a socket connects, so a socket opened with the old secret before the rotation stays attached until it reconnects. Support closes every socket on the gateway, and only connectors with the new secret can attach again.
- In Monitor > Logs, review the calls the tunnel served since the suspected leak.
With short-lived connector credentials turned on, the secret alone can't attach a connector, so a leak is far less urgent. Rotate it anyway.
Short-lived connector credentials (beta)
By default a connector proves itself with AUTH_SECRET alone, one secret that doesn't expire. You can also require every socket to present a credential that expires within minutes or hours, issued by your own identity system. This is the same idea as workload identity federation. A leaked AUTH_SECRET alone can then no longer attach a connector, and Willow checks the identity again at least every hour.
This is a beta feature. Once it is on for your organization (Settings > Beta Features > Short-Lived Tunnel Credentials), each tunnel card has a Credentials button.
| OIDC token | Client certificate | |
|---|---|---|
What run presents | A JWT from your identity provider | A JWT that run signs with the certificate's private key on each connection, with the certificate attached |
| What Willow checks | The signature against the issuer's published keys, the exact issuer and subject, that the token was issued for the tunnel URL, and a lifetime of at most 24 hours | That your CA issued the certificate and it is valid now, its common name if you set one, the signature made with its key, that the assertion was made for the tunnel URL, and a lifetime of at most 5 minutes |
| Good for | Kubernetes service accounts (EKS, GKE, AKS, or any cluster with an OIDC issuer), SPIFFE JWT-SVIDs, cloud workload identity | An internal PKI, cert-manager, SPIFFE X.509-SVIDs |
Willow's edge terminates TLS before the tunnel endpoint, so a client certificate presented during the TLS handshake would never reach the code that checks it. Signing a short assertion with the certificate's key proves the same thing: the connector holds a key your CA certified. The key never leaves your cluster.
How the credential behaves:
- Checked on every socket. Willow checks the credential when each socket connects, in addition to the secret. A failed check is refused with HTTP 401, and the reason appears in the
runlog. - Renewed without a gap. Before the credential expires, and at least every hour, Willow stops sending new calls to the socket and asks the connector to open a replacement. The connector dials a new socket with a fresh credential right away. Calls already running on the old socket get up to 5 minutes to finish.
- Applies to connectors already attached. Willow re-checks sockets attached with the secret alone every 5 minutes. After you turn credentials on, those sockets are disconnected within 5 minutes, and they can't reattach until they present a credential.
- Deploy first, then require it. A connector may send a credential before the tunnel requires one; Willow ignores it until then. Configure the connector, confirm it still connects, then save the tunnel's credentials. That way the tunnel stays up throughout.
- Turning it off. Credentials > Auth secret only. That works even after the beta is turned off for your organization. Turning off the beta does not turn off a tunnel that already requires credentials.
With a Kubernetes service account token
run asks the Kubernetes API for a 1-hour token for its own service account, issued for the tunnel URL. The token is useless anywhere else: the Kubernetes API itself rejects it, because it was issued for the tunnel URL.
-
Find your cluster's issuer.
# Amazon EKSaws eks describe-cluster --name <cluster> --query cluster.identity.oidc.issuer --output text# Google GKE, and most other clusterskubectl get --raw /.well-known/openid-configuration | jq -r .issuer# Azure AKS (the OIDC issuer must be enabled on the cluster)az aks show -n <cluster> -g <resource-group> --query oidcIssuerProfile.issuerUrl -o tsvWillow fetches the issuer's public keys from
<issuer>/.well-known/openid-configuration, so the issuer must be reachable over HTTPS from the internet. EKS, GKE and AKS issuers are. If your cluster's issuer is private, paste the output ofkubectl get --raw /openid/v1/jwksunder Issuer not reachable from the internet? in the dialog. Paste it again whenever the cluster rotates its signing key. -
Find
run's service account. The subject issystem:serviceaccount:<namespace>:<name>.kubectl get pod -n <namespace> -l app=run -o jsonpath='{.items[0].spec.serviceAccountName}' -
Let
runrequest its own token. This Role allows exactly that and nothing else:apiVersion: rbac.authorization.k8s.io/v1kind: Rolemetadata:name: willow-run-token-requestnamespace: <namespace>rules:- apiGroups: [""]resources: ["serviceaccounts/token"]resourceNames: ["<service-account>"]verbs: ["create"]---apiVersion: rbac.authorization.k8s.io/v1kind: RoleBindingmetadata:name: willow-run-token-requestnamespace: <namespace>subjects:- kind: ServiceAccountname: <service-account>namespace: <namespace>roleRef:apiGroup: rbac.authorization.k8s.iokind: Rolename: willow-run-token-request -
Configure
run. AddTUNNEL_CREDENTIAL_SOURCE: "kubernetes"underdeployments.run.envinvalues.yamland upgrade the release. The pod needs its service account token mounted, which is the Kubernetes default. Check that therunlog still showsconnected to Willow. If it showscould not produce the connector credential, the reason follows it, usually the Role from step 3. -
Require it. On the tunnel card, select Credentials > OIDC token, enter the issuer and subject, and select Save. Willow checks that it can fetch the issuer's keys before it saves. The card then shows Short-lived credentials.
The token must be issued for the tunnel URL, which run takes from BASE_URL.
Other identity providers. Any OIDC issuer works if its tokens are JWTs signed with RSA or ECDSA (RS256, PS256, ES256 and their larger variants) that expire within 24 hours. Have your identity agent write the token to a file in the run container, and set TUNNEL_CREDENTIAL_FILE to its path; run reads it again on every connection. If your provider can't issue tokens for the tunnel URL, set the token's audience in the dialog.
With a client certificate
-
Issue the connector a certificate from your CA, with an RSA or ECDSA (P-256, P-384, P-521) key. Your CA must be its direct issuer; if you use an intermediate CA, register the intermediate.
-
Store it in the cluster.
kubectl create secret tls willow-connector-tls \--namespace <namespace> \--cert=connector.crt --key=connector.key -
Configure
run. Add this underdeployments.runinvalues.yamland upgrade the release:secretEnv:TUNNEL_CLIENT_CERT:secretName: "willow-connector-tls"key: "tls.crt"TUNNEL_CLIENT_KEY:secretName: "willow-connector-tls"key: "tls.key"TUNNEL_CLIENT_CERTandTUNNEL_CLIENT_KEYtake either the PEM itself or a path to a file. Environment variables are read when the pod starts, so restartrunafter the certificate is renewed. With a file path instead,runreads the files again on every connection. -
Require it. On the tunnel card, select Credentials > Client certificate, paste your CA's certificate (PEM; several are fine, for example during a CA rollover), optionally require a common name, and select Save. Willow refuses a private key or a certificate that isn't a CA.
If the key doesn't match the certificate, or the certificate has expired, run doesn't connect and its log says which.
Connector credential variables
| Variable | Purpose |
|---|---|
TUNNEL_CREDENTIAL_SOURCE | kubernetes requests a token for run's service account. file and certificate are inferred from the variables below, so you rarely set them. |
TUNNEL_CREDENTIAL_FILE | Path to a token file kept fresh by another agent. Read again on every connection. |
TUNNEL_CLIENT_CERT / TUNNEL_CLIENT_KEY | The client certificate (with any chain after it) and its private key: PEM, or paths to PEM files. |
TUNNEL_CREDENTIAL_AUDIENCE | What the credential is issued for. Default: BASE_URL. Set it only if you set an audience on the tunnel, or force the connector on with TUNNEL_ENABLED=true while BASE_URL isn't the tunnel URL. |
Switching an existing hybrid install to a tunnel
You can run both side by side. Add a Willow Tunnel gateway, deploy a second run release (or point the existing one at the tunnel BASE_URL with its ingress disabled), confirm the tunnel card is Healthy, then Set as Default on the tunnel card and remove the old External Run Service gateway and its ingress/DNS/certificate at your leisure. MCP clients configured with the old gateway's own URL need to switch to your organization's MCP URL, which the dashboard's connection instructions now show.
Error responses
These are the responses Willow itself returns on the tunnel URL. Anything else, including 401, comes from your run and means the tunnel delivered the request. MCP clients see the same conditions as tool errors whose code is the upper-cased error, for example TUNNEL_NOT_CONNECTED.
| Status | error | Meaning |
|---|---|---|
503 | tunnel_not_connected | No connector is attached to this gateway, or none of its sockets could be reached. Willow tries every attached socket before giving up. |
502 | tunnel_disconnected | The tunnel dropped before your run sent response headers. |
502 | tunnel_upstream_error | The connector is attached but your run's own listener did not answer, or the stream failed on your side. The message field carries the reason. |
502 | tunnel_empty_response / tunnel_bad_response | Your run ended the stream without a valid response. Usually a pod restarting mid-request. |
504 | tunnel_response_timeout | Your run did not send response headers within 290 seconds. |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
Card reads Connector not attached; run log shows nothing about the tunnel | BASE_URL is not the tunnel URL, TUNNEL_ENABLED=false is set, or AUTH_SECRET is empty in the pod. With no secret the connector does not start at all. | kubectl exec into the pod and env | grep -E 'BASE_URL|TUNNEL|^ORG=', and confirm AUTH_SECRET is set (do not print it). Fix values.yaml or willow-secrets, re-run Helm. |
run log: Willow refused the tunnel handshake with HTTP 400 Unsupported tunnel protocol | The connector's run image speaks a different tunnel protocol version than Willow | Upgrade the run image to a current chart release. |
run log: local run did not answer; clients get 502 tunnel_upstream_error | The connector replays requests to 127.0.0.1:PORT, and nothing is listening there | Make sure PORT in the pod's environment is the port run actually listens on (the chart uses 3000). |
run log: Willow rejected the connector's AUTH_SECRET (HTTP 401) | AUTH_SECRET does not match any tunnel gateway: wrong value, rotated since, or the gateway was deleted and recreated | Compare the secret with the Step 1 value; Rotate Secret if unsure and roll willow-secrets. |
run log: Willow rejected the connector's AUTH_SECRET (HTTP 403) | The secret belongs to a plain External Run Service gateway, or the host in BASE_URL is another organization's | Use the secret from a Willow Tunnel card, and make sure the tunnel URL host is your own Connect host. |
run log: Willow rejected the connector (HTTP 401) with a reason about the connector credential | The tunnel requires a short-lived credential and the connector sent none, or one with the wrong issuer, subject, audience or CA, or one that has expired | Read the reason: it names the field that didn't match. Compare it with Credentials on the tunnel card, and check that BASE_URL is exactly the tunnel URL. |
run log: could not produce the connector credential; retrying | run couldn't get its credential, so it doesn't dial at all. Typical reasons: the Role for serviceaccounts/token is missing, the token file is unreadable, or the certificate and key don't match. | Fix what the log names. With TUNNEL_CREDENTIAL_SOURCE=kubernetes, apply the Role and RoleBinding from With a Kubernetes service account token. |
run log: connection errors with ECONNREFUSED/ENOTFOUND/proxy messages | Egress to the Connect host on 443 is blocked, or a corporate proxy is required | Allow HTTPS egress to the Connect host; set HTTPS_PROXY/NO_PROXY on the run deployment. |
| Connector attaches, card says reachable but Auth issue | The pod has a different AUTH_SECRET than Willow stored (typically a stale Kubernetes secret after a rotate) | Update willow-secrets, restart the deployment. |
Clients get TUNNEL_NOT_CONNECTED intermittently; run log shows disconnected from Willow; reconnecting or no traffic from Willow for 90s | Every socket is flapping at once. Either the pod is restarting, or an egress firewall or proxy is killing idle sockets. | Check pod restarts and events. Willow pings every 30 seconds, so any egress idle timeout on the path must be comfortably above 30 seconds. Keep TUNNEL_CONNECTIONS at 2 or more, and run two or more replicas. |
Clients get TUNNEL_DISCONNECTED, or a stream ends abruptly | The socket carrying the call dropped while it was running, typically a pod restart. Willow does not retry it, because the tool may already have run. | Expected now and then during rollouts. New calls go to the sockets that are still attached; the client can retry the call. |
A tool call fails with TUNNEL_CREDENTIAL_UNSUPPORTED | The client authenticates with an older user access key, which Willow doesn't relay | Reconnect the client through the dashboard's connection instructions so it signs in with OAuth. |
A background agent's tool call fails with TUNNEL_AGENT_GATEWAY_MISMATCH | The agent is set to a Willow-hosted gateway but uses an MCP server on the tunnel | Set the agent's gateway to the tunnel, then sync it so its platform gets the new endpoint. |
A background agent receives Slack messages but never replies; its reply tool returns Slack replies are not configured | The agent runs on the tunnel, and no slack-background-agent runs next to that run | Follow Slack background agents. |
Clients get 504 tunnel_response_timeout | A request took more than 290 seconds to produce response headers | Find the slow tool in your run logs. Long operations should stream their progress (SSE) so headers go out immediately. |
Health card reports an auth or OAuth resource problem | BASE_URL differs from the tunnel URL (trailing path, wrong host) | BASE_URL must be exactly the card's Run service BASE_URL: value, with no suffix. |
| An MCP client lists the tunnel's tools but a new tool is missing | Willow answers tools/list from its stored catalog, which refreshes when the MCP server is discovered | Refresh the MCP server's tools from the dashboard; discovery runs through the tunnel. |
Limits
- One tunnel gateway serves one hybrid
rundeployment (any number of replicas). To tunnel a second, independent deployment, create a second tunnel gateway. - MCP clients reach tunnel MCP servers with OAuth or Willow API tokens. Older user-access-key credentials are not relayed.
- Background agents aren't relayed per call. An agent that uses MCP servers on the tunnel must be set to the tunnel gateway itself; its endpoint is then served by your
runthrough the tunnel. - The tunnel carries HTTP (including SSE). It does not carry raw TCP, so it cannot expose a database or an arbitrary internal MCP server on its own. Point those at your
runas you would in any hybrid install, andrunreaches them from inside your network. - Request bodies and responses are streamed, but every request must produce response headers within 290 seconds. Very long-running operations should use the MCP streaming patterns they already use behind an ingress.