How to delete a node label by command and api?
Solution 1:
create labels for the nodes:
kubectl label node <nodename> <labelname>=allow
delete above labels from its respecitve nodes:
kubectl label node <nodename> <labelname>-
Solution 2:
Below command worked for me to remove label:
kubectl label node <nodename> <label>-
Note: The syntax is a minus sign directly after the key. For example, if the node name is worker1 and the label is system=workernode, you can remove a label with the following command.
kubectl label node worker1 system-
Solution 3:
From kubectl label -h:
Update pod 'foo' by removing a label named 'bar' if it exists.
Does not require the --overwrite flag.
$ kubectl label pods foo bar-
The same works for nodes.