OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

To get all pods in name spaces and in turn get image version of each pod using rest API's/client libraries

  • Thread starter Thread starter New123
  • Start date Start date
N

New123

Guest
I have https://containers.cloud.ibm.com/global/swagger-global-api - Kubernetes API swagger to drill upto each clusters details till namespaces.Using IAM token to access these API’s. Further, i want to get all the pods of that specific namespace and in turn image version of each pod.

I have tried using https://github.com/kubernetes-client/javascript client libraries to fetch all pods,But how will i get the pods of namespaces from my cluster of my account programatically?

This i want to achieve either by using REST API's or some client libraries.How to use these libraries?

Code:
var k8s = require('@kubernetes/client-node');
const kc = new k8s.KubeConfig();
    kc.loadFromDefault();
 const k8sApi = kc.makeApiClient(k8s.CoreV1Api);

    const listFn = () => k8sApi.listPodForAllNamespaces()
    console.log(listFn);

I get nothing from the above code.

<p>I have <a href="https://containers.cloud.ibm.com/global/swagger-global-api" rel="nofollow noreferrer">https://containers.cloud.ibm.com/global/swagger-global-api</a> - Kubernetes API swagger to drill upto each clusters details till namespaces.Using IAM token to access these API’s.
Further, i want to get all the pods of that specific namespace and in turn image version of each pod.</p>

<p>I have tried using <a href="https://github.com/kubernetes-client/javascript" rel="nofollow noreferrer">https://github.com/kubernetes-client/javascript</a> client libraries to fetch all pods,But how will i get the pods of namespaces from my cluster of my account programatically? </p>

<p>This i want to achieve either by using REST API's or some client libraries.How to use these libraries?</p>

<pre><code>var k8s = require('@kubernetes/client-node');
const kc = new k8s.KubeConfig();
kc.loadFromDefault();
const k8sApi = kc.makeApiClient(k8s.CoreV1Api);

const listFn = () => k8sApi.listPodForAllNamespaces()
console.log(listFn);
</code></pre>

<p>I get nothing from the above code.</p>
 

Online statistics

Members online
0
Guests online
4
Total visitors
4
Top