Skip to content

SSL Certificate Verification Error in @kubernetes/client-node in last version in Watch Example #2358

@f4rx

Description

@f4rx

Describe the bug
watch function doesn't work in the local kubernetes

Client Version
1.1.1

Server Version
microk8s v1.32.3

To Reproduce
run example https://github.com/kubernetes-client/javascript/blob/main/examples/typescript/watch/watch-example.ts

    at node:internal/deps/undici/undici:13502:13
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async Watch.watch (file:///root/cl_test/node_modules/@kubernetes/client-node/dist/watch.js:39:30)
    at async file:///root/cl_test/ex8.js:7:13 {
  [cause]: Error: unable to verify the first certificate
      at TLSSocket.onConnectSecure (node:_tls_wrap:1679:34)
      at TLSSocket.emit (node:events:518:28)
      at TLSSocket._finishInit (node:_tls_wrap:1078:8)
      at ssl.onhandshakedone (node:_tls_wrap:864:12) {
    code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'
  }
}

Expected behavior
The example would work

Example Code
See https://github.com/kubernetes-client/javascript/blob/main/examples/typescript/watch/watch-example.ts

Environment (please complete the following information):

Ubuntu 24.04.2 LTS

node -v
v22.14.0

microk8s kubectl version
Client Version: v1.32.3
Kustomize Version: v5.5.0
Server Version: v1.32.3

Additional context

  1. Temporary workaround: Downgrade to 0.22.3. I guess the reason is due to migration from request

  2. NODE_TLS_REJECT_UNAUTHORIZED=0 does not work, I get Error: Unauthorized statusCode: 401

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions