Unable to create a new Kubanetes deployment using node 'kubernetes-client'

6/13/2017
const k8s = require('kubernetes-client');
const endpoint = 'https://' + IP;

const ext = new k8s.Extensions({
  url: endpoint,
  version: 'v1beta1',
  insecureSkipTlsVerify: true,
  namespace,
  auth: {
      bearer: token,
  },
});

const body = {
spec: {
    template: {
        spec: {
            metadata: [{
                name,
                image,
            }]
        }
    }
}
};

ext.namespaces.deployments(name).put({body}, (err, response => { console.log(response); })

The above functions seem to authenticate with GET and PUSH, however I get the following error message when using POST.

the server does not allow this method on the requested resource Blockquote

-- Darren Ackers
deployment
google-cloud-platform
kubernetes

1 Answer

6/18/2017

I think the problem might be, that due to changes of Kubernetes 1.6 to RCAB your pod has not the right privileges to schedule pods, get logs, ... through the API server.

Make sure you are using the admin.conf kubeconfig. But be aware that giving the node cluster admin permissions sets anyone who can access the node to cluster admin ;)

-- Langhalsdino
Source: StackOverflow