kubernetes-client
kubernetes-client copied to clipboard
Issue in sample: Client not found
If I execute the sample code given in the Github readme. The node application throws error that client is not defined.
The code I executed is
const config = { apiVersion: 'v1', clusters: [], contexts: [], 'current-context': '', kind: 'Config', users: [] } const { KubeConfig } = require('kubernetes-client') const kubeconfig = new KubeConfig() kubeconfig.loadFromString(JSON.stringify(config))
const Request = require('kubernetes-client/backends/request') const backend = new Request({ kubeconfig }) const client = new Client({ backend, version: '1.13' })
The error I got is
(node:11776) UnhandledPromiseRejectionWarning: ReferenceError: Client is not defined
at getNamespaces (F:\Docker\PARSEC-TOOL\TaskRunner.js:84:18)
at Object.
Can someone help me out
And I am new to Kubernetes, I just copied the configuration from the kubectl config view. What's the best way of getting authenticated to my cluster
Plus when I give the configuration for users how is it done
Bump, same issue
In case if others are still looking, client wasnt initialized properly
const Client = require('kubernetes-client').Client;