Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does the post accept yaml manifest file ? #38

Open
lakshmantgld opened this issue May 12, 2017 · 4 comments
Open

Does the post accept yaml manifest file ? #38

lakshmantgld opened this issue May 12, 2017 · 4 comments

Comments

@lakshmantgld
Copy link

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?.

@shenshouer
Copy link
Collaborator

shenshouer commented May 12, 2017

Can you post the the detail of error?

@shenshouer
Copy link
Collaborator

@junjun16818 is there any example for create pod via the api or in the test ?

@lakshmantgld
Copy link
Author

@shenshouer I changed the manifest to JSON and it worked.

@Isaacs9
Copy link

Isaacs9 commented May 18, 2017

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants