what's the mean of 'create a node' in kubernetes api

10/12/2017

i fount the api in kubernetes doc:

Write Operations

HTTP Request POST /api/v1/nodes

Query Parameters Parameter Description pretty If 'true', then the output is pretty printed. Body Parameters Parameter Description body Node
Response Code Description 200 Node OK

the detail of this api is here

I test this api. send a post requst with this request body:

{"kind": "Node",
 "apiVersion": "v1",
 "metadata": {
 "name": "10.110.17.48"
 }}

the response is

{
"kind": "Node",
"apiVersion": "v1",
"metadata": {
    "name": "10.110.17.48",
    "selfLink": "/api/v1/nodes10.110.17.48",
    "uid": "61bfa1e6-af14-11e7-8194-005056b6695e",
    "resourceVersion": "3684908",
    "creationTimestamp": "2017-10-12T06:12:53Z"
},
"spec": {
    "externalID": "10.110.17.48"
},
"status": {
    "daemonEndpoints": {
        "kubeletEndpoint": {
            "Port": 0
        }
    },
    "nodeInfo": {
        "machineID": "",
        "systemUUID": "",
        "bootID": "",
        "kernelVersion": "",
        "osImage": "",
        "containerRuntimeVersion": "",
        "kubeletVersion": "",
        "kubeProxyVersion": "",
        "operatingSystem": "",
        "architecture": ""
    }
}
}

then i check the kubectl get nodes

[root@master3 yum.repos.d]# kubectl get nodes
NAME           STATUS     AGE       VERSION
10.110.17.48   NotReady   18m       
master1        Ready      20d       v1.6.4+coreos.0
master2        Ready      20d       v1.6.4+coreos.0
master3        Ready      20d       v1.6.4+coreos.0
slave1         Ready      20d       v1.6.4+coreos.0
slave2         Ready      20d       v1.6.4+coreos.0
slave3         Ready      44m       v1.6.4+coreos.0

this node is not ready.

this node is only a centos os,not install the kubelet,kube-proxy,clico-node.

if i use this node?should i install kubelet,kube-proxy,clico-node on this node?

and then,what's the meaning of this api? just notifiy api server to store this node info in etcd?

-- user2803338
kubernetes

1 Answer

10/12/2017

and then,what's the meaning of this api? just notifiy api server to store this node info in etcd?

Yup, that's it. POST-ing to an API endpoint does not cause kubernetes to attempt to take any actions on your machine -- that is the entire purpose of running kubelet on such a machine: granting kubernetes "permission" and the means to enact changes on a Node

A hypothetical use for POST-ing to that API before kubelet starts up may be -- and I stress may be -- to declare your intention to start a Node in the very near future, so if (hypothetically) you only ever wanted 10 Nodes in your cluster, then POST-ing to the API allows notifying your colleagues that you are starting the Node, and they don't have to.

-- mdaniel
Source: StackOverflow