node-k8s-client
node-k8s-client copied to clipboard
Does the post accept yaml manifest file ?
Thank you for your hard work. I have a question related to creating a pod using KubeAPI.
I am trying to create a pod using the following snippet:
var K8s = require('k8s');
var kubeapi = K8s.api({
"endpoint": "https://***.**.**.**",
"version": "/api/v1",
"auth": {
"clientCert": Buffer.from(clientCert, 'base64'),
"clientKey": Buffer.from(clientKey, 'base64'),
"caCert": Buffer.from(caCert, 'base64')
}
});
kubeapi.post("namespaces/default/pods", require("./podUbuntuManifest.yaml"), function(err, data){
console.log("Create namespaces/default/pods");
if (err) {
console.log("error in namespaces/default/nodes");
console.log(err);
}
console.log("printing success data of create namespaces/default/nodes");
console.log(JSON.stringify(data));
});
I get a ReferenceError in Yaml. But the yaml syntax is ok, I have verified with an online yamlLint. Only JSON is supported?
Can you provide an detailed example for creating a pod using the kubeApi?.
Can you post the the detail of error?
@junjun16818 is there any example for create pod via the api or in the test ?
@shenshouer I changed the manifest to JSON and it worked.
@lakshmantgld do you have any example of how you configured your client? the me returns an error when I run a get in the pods pod:the server doesn't have the resource type "pods", and also to a get in the nodes nod:pod:the server doesn't have the resource type "pods". I've tried various forms