<p>I am trying to work my way into the <a href="https://github.com/kubernetes-client/javascript" rel="nofollow noreferrer">kubernetes javascript client</a>.</p>
<p>My goal is to create a Job and a secret from inside the cluster.</p>
<p>The <a href="https://github.com/kubernetes-client/javascript" rel="nofollow noreferrer">kubernetes javascript client</a> provide examples on how to create a <a href="https://github.com/kubernetes-client/javascript/blob/master/examples/in-cluster.js" rel="nofollow noreferrer">in-cluster config</a> and make simples API calls , but the generated documentation is no big help if you want to interact with other kubernetes objects (Jobs and Secret in my case)...</p>
<p>The documentation reference all the classes , but that's all.</p>
<p>So , do you have already worked with the Kubernetes javascript client ? Is there a more precise documentation or more examples ? (I wasn't succesful in my reshearsh)</p>
<p>Or , do you know how to create Jobs/Secret from the Client?</p>
<p>I Won't post my code here , because I only made the in-cluster config , it's only a copy from the repo example.</p>
<p>Thanks a Lot in advance! :)</p>

Popopame
<p>So , after a little meddling with the <a href="https://github.com/kubernetes-client/javascript" rel="nofollow noreferrer">Kubernetes Javascript Client</a> and with the help of the commentary of @François I found what I was looking to achieve.</p>
<p>The documentation of the K8s javascript client is very &quot;minimal&quot; , an the best way to see what is possible is using a good Code Editor (Code for me).</p>
<p>Based on <a href="https://github.com/kubernetes-client/javascript/blob/master/examples/ingress.js" rel="nofollow noreferrer">this</a> example  you see the createNamespacedIngress , and all the other K8s object linked with the CoreV1Api are created with the same nomenclature.</p>
<p>If you want to create an object that is not managed by the CoreV1Api , you need to use the makeApiClient method on the Api you need to interacy with.</p>
<p>So , for creating a Job , I needed to use the BatchV1Api.</p>
<p>I'll try to upload an example on the Javasript client repo , to maybe , help more poor lost souls like me.
Snippet of the code:</p>
<pre><code>const k8sCoreV1Api = kc.makeApiClient(k8s.CoreV1Api); // we call the CoreV1Api that will be used for the creation of the secrets
</code></pre>
<p>const k8sBatchV1Api = kc.makeApiClient(k8s.BatchV1Api); //we call the BatchV1Api that will be used for the creation of the jobs</p>
<p>Here is the whole sample here : <a href="https://pastebin.com/FXWA17RQ" rel="nofollow noreferrer">https://pastebin.com/FXWA17RQ</a></p>
