Unable To Get All The Jobs Inside A Cluster Using @kubernetes/client-node
I am using @kubernetes/client-node to access Kubernetes server API. I can get all the Pods from default using: const k8s = require('@kubernetes/client-node'); const kc = new k8s.K
Solution 1:
You have to pass the Kube config file location instead of any YAML file
const { KubeConfig } = require('kubernetes-client')
const kubeconfig = new KubeConfig()
kubeconfig.loadFromFile('~/some/path')
const Request = require('kubernetes-client/backends/request')
const backend = new Request({ kubeconfig })
const client = new Client({ backend, version: '1.13' })
https://github.com/godaddy/kubernetes-client#initializing
However if you are planning to run the POD or container on K8s cluster you can also use : kc.loadFromCluster();
https://github.com/kubernetes-client/javascript/blob/master/examples/in-cluster.js
If you want to pass any YAML and apply those changes to cluster you can use the
https://github.com/kubernetes-client/javascript/blob/master/examples/yaml-example.js
Post a Comment for "Unable To Get All The Jobs Inside A Cluster Using @kubernetes/client-node"