<p>My custom definition</p>
<pre><code>apiVersion: something.com/v1alpha1
 kind: MyKind
 metadata:
   name: test
 spec:
   size: 1
   image: myimage
   
</code></pre>
<p><a href="https://stackoverflow.com/questions/64297139/createdeployment-with-kubernetes-javascript-client">Here</a> is an answer that shows how to create a deployment using a javascript client. However, I need to create a custom resource using a javascript client</p>

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

var body = {
    &quot;apiVersion&quot;: &quot;something.com/v1alpha1&quot;,
    &quot;kind&quot;: &quot;MyKind&quot;,
    &quot;metadata&quot;: {
        &quot;name&quot;: &quot;mycustomobject&quot;,
    },
    &quot;spec&quot;: {
        &quot;size&quot;: &quot;1&quot;,
        &quot;image&quot;: &quot;myimage&quot;
    }
}

k8sClient.createNamespacedCustomObject('something.com','v1alpha1','default','mykinds', body)
    .then((res)=&gt;{
        console.log(res)
    })
    .catch((err)=&gt;{
        console.log(err)
    })
</code></pre>
