Goyoo / node-k8s-client

kubernetes client of node.js
MIT License
164 stars 59 forks source link

Trouble connecting/accessing information from cluster #44

Open vmarcel opened 7 years ago

vmarcel commented 7 years ago

Hello, I am trying to use this package to connect to Google Container Engine, which uses kubernetes. The issue is I am unsure why I am getting either no value or undefined when I am trying to get a simple list of the pods. here is my config:

var kubectl = k8s.kubectl({
  endpoint: 'https://[cluser ip]',
  namespace: 'default',
  binary: '/usr/local/bin/kubectl',
  auth: {
    username: '[user]',
    password: '[pass]'
  }
})

How I am calling the function:

  kubectl.pod.list(function (err, pods) {
    console.log(pods)
  })

any reason why I this is not working?

emanuelecasadio commented 6 years ago

I am on Azure Container Service. I have tried using REST API with the three .pem files and it works like a charm.

khaled-nabil commented 6 years ago

Have you managed to get it to work? I am running through the same issue.

emanuelecasadio commented 6 years ago

Yes, I got it working but now I don't use it anymore. However, I extracted the three .pem files from the ~/.azure or ~/.kube directory (they were encoded in base64 within a configuration file, if I can remember) and just used those files to access the cluster.