kubernetes如何删除nodes?

kubectl get nodes

NAME           LABELS                                STATUS     AGE
10.31.31.181   kubernetes.io/hostname=10.31.31.181   NotReady   13d
10.31.31.28    kubernetes.io/hostname=10.31.31.28    NotReady   13d
10.31.31.29    kubernetes.io/hostname=10.31.31.29    NotReady   13d
k8s-node1      kubernetes.io/hostname=k8s-node1      Ready      52m
k8s-node2      kubernetes.io/hostname=k8s-node2      Ready      59m
k8s-node3      kubernetes.io/hostname=k8s-node3      Ready      57m
kx-k8s-181     kubernetes.io/hostname=kx-k8s-181     NotReady   13d

kubectl describe 10.31.31.181




如何删除上面STATUS为NotReady的nodes?
已邀请:

kine

赞同来自: akin520 styshoo


<pre>

kubectl get nodes

NAME LABELS STATUS AGE
10.31.31.181 kubernetes.io/hostname=10.31.31.181 NotReady 13d
10.31.31.28 kubernetes.io/hostname=10.31.31.28 NotReady 13d
10.31.31.29 kubernetes.io/hostname=10.31.31.29 NotReady 13d
k8s-node1 kubernetes.io/hostname=k8s-node1 Ready 2h
k8s-node2 kubernetes.io/hostname=k8s-node2 Ready 2h
k8s-node3 kubernetes.io/hostname=k8s-node3 Ready 2h

kubectl delete node 10.31.31.29

node "10.31.31.29" deleted

</pre>

或者

<pre>

etcdctl ls /registry/minions

/registry/minions/k8s-node2
/registry/minions/k8s-node3
/registry/minions/k8s-node1
/registry/minions/10.31.31.181
/registry/minions/10.31.31.28

etcdctl rm /registry/minions/10.31.31.181

PrevNode.Value: {"kind":"Node","apiVersion":"v1","metadata":{"name":"10.31.31.181","selfLink":"/api/v1/nodes/10.31.31.181","uid":"c6dc3b90-def0-11e5-89e4-0050563a518c","resourceVersion":"34574","creationTimestamp":"2016-02-29T14:29:01Z","labels":{"kubernetes.io/hostname":"10.31.31.181"}},"spec":{"externalID":"10.31.31.181"},"status":{"capacity":{"cpu":"2","memory":"485280Ki","pods":"40"},"conditions":,"addresses":,"daemonEndpoints":{"kubeletEndpoint":{"Port":10250}},"nodeInfo":{"machineID":"ce2600fa76394b31b84341ae187557fb","systemUUID":"564DA97A-E67A-DE10-267F-73796F779D44","bootID":"9acf89ac-b644-41ad-896c-b090c4b28e4a","kernelVersion":"3.10.0-327.el7.x86_64","osImage":"CentOS Linux 7 (Core)","containerRuntimeVersion":"docker://1.8.2-el7.centos","kubeletVersion":"v1.2.0","kubeProxyVersion":"v1.2.0"</pre>

}}}

徐新坤 - 京东商城-TIG-JDOS团队

赞同来自:


为什么要删除呢?既然他是NotReady,不会影响你的任何k8s操作和使用。
如果确实非要删除,可以直接从etcd把对应数据清除。

抹香

赞同来自:


kubectl delete node

要回复问题请先登录注册