Create nodes using the kubernetes API

7/17/2015

I noticed that there is an api available for generating a node/s using yaml/json.

So far my attempts have failed however, as i get: 2015/07/17 16:07:54 http: proxy error: dial tcp xxx.xxx.xx.xxx:443: connection refused.

Note that I am using the kubectl proxy to access the API: kubectl proxy --port=8080 &

I have managed to create replication controllers and services using the API, but I am stuck on this part. In an attempt to bypass the API, I have modified the config-default.sh file in kubernetes/cluster/gce, and I tried to run it using php. I received the following response: Can't find gcloud in PATH. Do you wish to install the Google Cloud SDK? [Y/n]. I dont receive this error when I run cluster/kube-up from my terminal.

Can anyone that has done this please assist?

Update/Edit

After playing around a bit, and using this link, I managed to create a node for a short period of time before it was deleted(Or dissapeared).

It turns out that I only created the (abstract?) concept/service for a node, and the Kubernetes Controller Manager Server took it down after not finding the resources allocated for it?

I then found this link by lavalamp, quote:

@abonas I think eventually k8s will need to run both ways: scenario a: User provisions node, calls POST to inform k8s of node existence. scenario b: User call POST to indicate desire for node; node-manager contacts cloud provider to allocate & provision a new node. Right now we only do a.

This post was made in January this year though, so can anyone officially comment if this is possible or not using any tool available?

-- Cipher
kubernetes
nodes

2 Answers

7/21/2015

I eventually decided to edit the values in: kubernetes/cluster/gce/config-default.sh using php.

I created a script in the root kubernetes directory and added the following lines:

export PATH="/Users/username/google-cloud-sdk/bin:$PATH"
cluster/kube-up.sh

I then ran the script from php, and hey presto :) Cluster creation from php.

It doesnt use the RESTful API, but it works.

-- Cipher
Source: StackOverflow

7/17/2015

Which API are you referring to? There's an API for a node to register itself with the cluster, but the apiserver itself won't actually spin up any new nodes for you.

If you are running on GCE / GKE, you can add new nodes to your cluster by resizing the managed instance group that contains your nodes.

-- Robert Bailey
Source: StackOverflow