How to delete a node label by command and api?

后端 未结 11 2204
被撕碎了的回忆
被撕碎了的回忆 2021-02-01 00:31

Add label to nodes:

$ kubectl label nodes 10.xx.xx.xx key1=val1 

If I want to delete label(key1=val1) on node(10.xx.xx.xx), how

相关标签:
11条回答
  • 2021-02-01 01:00

    This worked for me. Add Label

    kubectl label node <node name> node-role.kubernetes.io/<role name>=<key - (any name)>
    

    Remove label

    kubectl label node <node name> node-role.kubernetes.io/<role name>-
    

    For More Info

    0 讨论(0)
  • 2021-02-01 01:02

    create labels for the nodes:

    kubectl label node <nodename> <labelname>=allow

    delete above labels from its respecitve nodes:

    kubectl label node <nodename> <labelname>-

    0 讨论(0)
  • 2021-02-01 01:06

    To add label to your node

    kubectl label node ip-172-31-15-136 mynode=tst mnode=ssd
    

    To remove label from your node

    kubectl label node ip-172-31-15-136 mynode- mynode-
    
    0 讨论(0)
  • 2021-02-01 01:12

    To add a label to kubernetes nodes:

    kubectl label node "your-node-name" node-role.kubernetes.io/worker=worker
    

    To remove a label from kubernetes nodes:

    kubectl label node "your node-name" node-role.kubernetes.io/worker-
    

    Note: To remove a label put a "-" symbol at the end of your label name

    0 讨论(0)
  • 2021-02-01 01:14

    You can remove the label from a single node using the following kubectl command

    kubectl label node 10.xx.xx.xx Key1-

    If you want to remove the label for all the nodes, use the following command

    kubectl label nodes --all Key1-

    0 讨论(0)
提交回复
热议问题