I'm implementing a function which can make a node offline/online from kubernetes cluster.
When I run kubectl delete node $nodename
, how can I read this node to the cluster?
It's said that if use API POST /api/v1/nodes
will cause the node state Not ready
. Is there a way to read the deleted node to cluster?
The way to (re)create a node depends on your cluster setup and Kubernetes version.
kubeadm reset
and kubeadm join ...
again on the node (you might need to create a new token if the original one was short-lived, see the linked doc)To add a previously deleted node on kubernetes > 1.8x for me it works restarting kubelet service on the node. It is registering then again in the cluster. But kubernetes has a possibility to make a node "online/offlilne":
> kubectl cordon -h
Mark node as unschedulable.
Examples:
# Mark node "foo" as unschedulable.
kubectl cordon foo
Usage:
kubectl cordon NODE [options]
and
> kubectl uncordon -h
Mark node as schedulable.
Examples:
# Mark node "foo" as schedulable.
$ kubectl uncordon foo
Usage:
kubectl uncordon NODE [options]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With