Description
Describe the bug
When using the client, load from default works to load, I get all the configurations and contexts. If I switch to a non-kind cluster it works. But when I try to access a kind cluster i get this error:
error: HTTP-Code: 403 Message: Unknown API Status Code! Body: "{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Failure\",\"message\":\"nodes is forbidden: User \\\"system:anonymous\\\" cannot list resource \\\"nodes\\\" in API group \\\"\\\" at the cluster scope\",\"reason\":\"Forbidden\",\"details\":{\"kind\":\"nodes\"},\"code\":403}\n" Headers: {"audit-id":"8faa772b-0a02-4a11-a4d0-1ddda79052a9","cache-control":"no-cache, private","content-length":"256","content-type":"application/json","date":"Thu, 09 Jan 2025 22:13:50 GMT","x-content-type-options":"nosniff","x-kubernetes-pf-flowschema-uid":"447ed637-32cb-4e79-9fe9-7007b399d374","x-kubernetes-pf-prioritylevel-uid":"b292a39e-9771-4796-ad28-0c0f74ac00d7"} code: "403"
using kubectl
it works, with the same selected context. And as described earlier, using any other cluster works fine. It does not matter what version of k8s is chosen. I have tried with 1.27, 1.32 and 1.29.12 version of kind, I get the same error.
Client Version
e.g. 1.0.0
Server Version
e.g. 1.27, 1.32, 1.29.12
To Reproduce
- install bun
- create
index.ts
file - initialize a kubernetes client loading from default.
- create core api client and list nodes
- install kind & create kind cluster
- run the ts file
Expected behavior
To get a 200 response with data for the nodes in the cluster
Example Code
const k8s = new KubeConfig()
k8s.loadFromDefault()
const apiClient = k8s.makeApiClient(CoreV1Api)
const nodes = await apiClient.listNode()
console.log(nodes)
Environment (please complete the following information):
- OS: MacOS 15.1.1
- Bun version: 1.1.29
Additional context
I tried the same with the client version 0.22.3
using the same code, same cluster same everything except the npm package and that works as expected