Closed
Description
Describe the bug
We could refactor the examples folder to make it more readable and maintainable. Like creating a folder called kubectl/equivalents
inside examples to give example for the corresponding kubectl command.
For example, creating NamespaceCreateEquivalent.js
file which shows you the code equivalent to kubectl command: kubectl create namespace test
** Client Version **
e.g. 0.18.1
** Example Code**
PodsFilterByNamespace.js
const k8s = require('@kubernetes/client-node');
const kc = new k8s.KubeConfig();
kc.loadFromDefault();
const k8sApi = kc.makeApiClient(k8s.CoreV1Api);
/*
This sample javascript code is equivalent to `kubectl get pod --namespace=demo-namespace`
*/
const main = async () => {
try {
const podRes = await k8sApi.listNamespacedPod('demo-namespace');
console.log('Pod: ', podRes.body.items[0].metadata);
} catch (err) {
console.error(err);
}
};
main();
Additional context
I have already started working on this and would love to get assigned for the same.
Metadata
Metadata
Assignees
Labels
No labels