Skip to content

Accessing a Rancher cluster fails with "unable to get issuer certificate" #430

Closed
@gautaz

Description

@gautaz

Hello,

This is very similar to #327 but the infrastructure used is public and the certificate is not self signed.

I am using the following piece of code:

const {join} = require('path');
const k8s = require('@kubernetes/client-node');
const kc = new k8s.KubeConfig();

kc.loadFromFile(join(__dirname, 'kubeconfig.yaml'));
kc.setCurrentContext('kubedev');

const k8sApi = kc.makeApiClient(k8s.CoreV1Api);

k8sApi.listPodForAllNamespaces()
  .then(console.log.bind(console))
  .catch(console.error.bind(console));

This fails this way:

Error: unable to get issuer certificate
    at TLSSocket.onConnectSecure (_tls_wrap.js:1474:34)
    at TLSSocket.emit (events.js:310:20)
    at TLSSocket._finishInit (_tls_wrap.js:917:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:687:12) {
  code: 'UNABLE_TO_GET_ISSUER_CERT'
}

But succeeds if insecure-skip-tls-verify: true is added to the kubeconfig.yaml file.

The kubeconfig.yaml file comes directly from the Rancher UI and works well with kubectl.

Any idea how I can diagnose this issue any further ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions