Skip to content

Troubleshooting

Start with kubectl leash status. It shows every policy’s phase, backend, token use and warnings in one place. The gateway’s refusals all begin with Leash:.

Refusals from the gateway

Message Cause Fix
pod … is not selected by any AgentPolicy The pod’s labels don’t match a policy’s agentSelector Fix the labels or the selector
pod … is selected by 2 AgentPolicies Two policies select the same pod Split the selectors so each pod has exactly one
no running pod has IP … The call came from outside a pod, or through a proxy that hides the pod’s IP Call the gateway directly from the agent pod
2 running pods share IP … hostNetwork pods Agents can’t use hostNetwork
model "…" is not in the AgentPolicy allowlist The model isn’t in models.allow Add it, or a glob. * doesn’t match /
AgentPolicy has no models section The policy doesn’t set models Add models.allow
daily token budget exhausted (429) The day’s budget is spent Wait for midnight UTC (see Retry-After) or raise dailyTokenBudget
agent is frozen by its AgentPolicy kill switch frozen: true kubectl leash unfreeze
tool "…" is denied by the AgentPolicy Matches denyTools, or isn’t in allowTools Change the tool rules
tool "…" requires human approval and then a refusal Nobody decided before approvalTimeout, or someone denied See kubectl leash approvals
unknown model provider or unknown MCP server Not in the gateway’s registry Add it to gateway.config

The agent can’t reach the gateway

  • Check the policy sets models or mcp. Egress to the gateway is only added when it does.
  • If the gateway isn’t in leash-system or doesn’t have the default labels, set --gateway-namespace and --gateway-label on the operator.

Domain names don’t resolve

  • On the NetworkPolicy fallback, fqdns rules aren’t enforced and the policy shows Degraded. Use Cilium, or allow the addresses with cidrs.
  • On Cilium, set ndots to 1 on the agent pods (see Restrict egress), and check the name exactly matches a matchName or matchPattern.
  • If the pods use a DNS server other than CoreDNS or kube-dns, set egress.dns.

The agent reaches more than it should

Look for EgressWidened on the policy. Another network policy allows egress from the same pods; Leash can’t take away what another policy allows. Remove it, or narrow its selector.

Frozen agents keep running

  • Without onFreeze.scaleToZero, they keep running, cut off. That’s expected.
  • With it, Jobs and bare pods still keep running. The Ready message counts them.
  • On the NetworkPolicy fallback, other policies that allow egress still apply while frozen. Check EgressWidened.

Vault

Symptom Fix
VaultNotConfigured Install with vault.enabled=true and vault.address
VaultError mentioning permission denied The operator’s Vault policy is missing a path. See Vault credentials
RevokeFailed The operator needs sudo on sys/leases/revoke-prefix/<prefix>
UnguardedPods Pods use the identity’s ServiceAccount without the policy’s guardrails. Give them their own ServiceAccount

Getting help

Search the issues, or open one with the output of kubectl leash status, the policy’s YAML and the operator and gateway logs.