Relationships
#4593 @swamp/kubernetes: all methods fail when kubeconfig tls-server-name is an IP address (kubectl accepts it)
Opened by aimar · 11/10/2026· Shipped 11/10/2026
Description
Every method of the @swamp/kubernetes types fails when the kubeconfig cluster entry sets tls-server-name to an IP address. kubectl accepts the same kubeconfig and connects with no error.
Error from swamp behavior run <name> list on a @swamp/kubernetes/node behavior:
The property 'options.servername' must not be an IP address. Received '203.0.113.10'(The IP address above is a placeholder. The real value is the public IP of the API server.)
Why this setup exists
The API server is reached through a local tunnel, so server is https://127.0.0.1:16443. The kubeconfig sets tls-server-name to the node IP, which is in the certificate as an IP SAN. This is a common pattern for port-forwards, SSH tunnels, and access proxies.
Steps to reproduce
Use a kubeconfig whose cluster entry has an IP address as the TLS server name:
clusters: - name: example cluster: server: https://127.0.0.1:16443 tls-server-name: 203.0.113.10 certificate-authority-data: <...>
Confirm that
kubectl --context example get nodesworks.swamp extension pull @swamp/kubernetesswamp behavior create @swamp/kubernetes/node example-nodes --global-arg context=exampleswamp behavior run example-nodes list
Expected: the node list, the same as kubectl.
Actual: the run fails with the options.servername error above.
Likely cause
buildClient in models/_lib/helpers.ts loads the kubeconfig with @kubernetes/client-node@1.4.0. The client passes tls-server-name to the TLS servername option. Node's tls.connect rejects an IP address there, because SNI allows host names only. Go's TLS stack (kubectl) handles an IP differently: it sends no SNI and verifies the certificate against the IP SAN.
Suggested fix
When the cluster's tlsServerName is an IP address (net.isIP(...) !== 0), do not pass it as servername. Verify the certificate against that IP instead, for example with a checkServerIdentity that calls tls.checkServerIdentity(<that IP>, cert). That matches the kubectl behavior. I have not tested this fix.
Workaround
Make a copy of the kubeconfig, set tls-server-name to a DNS name that is in the certificate SANs (kubernetes worked for k3s), and point the behavior at the copy with the kubeconfig global argument.
Environment
- swamp
20261110.125620.0-sha.c7f34885 @swamp/kubernetes2026.11.07.1(typesnode,pod,pvcall affected)@kubernetes/client-node1.4.0(pinned by the extension)- kubectl client
v1.33.1, server k3sv1.36.5+k3s1 - macOS 27.0.1
Upstream repository: https://github.com/swamp-club/swamp-extensions
Environment
- Extension:
@swamp/kubernetes@2026.11.07.1 - swamp:
20261110.125620.0-sha.c7f34885 - OS:
darwin(aarch64) - Deno:
2.9.8 - Shell:
/bin/zsh
Shipped
Click a lifecycle step above to view its details.
system commented 11/10/2026, 5:20:52 PM
Classified automatically when this issue was filed.
- Source: Extensions
If you feel this classification is incorrect, add a ripple to tell us so.
stack72 commented 11/10/2026, 8:33:05 PM
Thanks @aimar for reporting this! We shipped: Make kubeconfig tls-server-name work when it is an IP address, as kubectl does, and bump @kubernetes/client-node 1.4.0 -> 2.0.1. The SDK passes tls-server-name straight to TLS servername, which Node refuses for an IP; the bump alone does not fix this but makes the fix point (createDispatcherOptions) public. Also repair error reporting the bump degrades: undici nests TLS and network errors inside 'fetch failed', so the TLS guidance and the connection error detail must be recovered from the cause chain.. The fix has been merged and a release is on its way. We appreciate your contribution to swamp.
Sign in to post a ripple.