Trying to use kubernetes-client and it works fine if I want to get a list of PODs. But how do I get a list of services, i.e.:
kubectl get services
I could not find any appropriate method in kubernetes-client:
const Client = require('kubernetes-client').Client;
const Config = require('kubernetes-client/backends/request').config;
const client = new K8sClient({ config: Config.fromKubeconfig(), version: '1.13' });
const pods = await client.api.v1.namespaces('xxxxx').pods.get({ qs: { labelSelector: 'application=test' } });
console.log('Pods: ', JSON.stringify(pods));
From the godaddy/kubernetes-client Libraries.
There seems to be:
api.v1.namespaces(namespace).services.get
list or watch objects of kind Service
Which looks the same as:
api.v1.namespaces(namespace).pods.get
list or watch objects of kind Pod