3. Label与Annotation
· 阅读需 1 分钟
3.1 Label
查看资源的标签信息
kubectl get nodes --show-labels
或者
kubectl describe nodes node01
Label的添加与删除,Key必须存在且唯一,Value可以为空、且不唯一
# 添加Label
kubectl label nodes node01 node-role.kubernetes.io/work=
# 删除Label
kubectl label nodes node01 node-role.kubernetes.io/work-
查看node的角色
kubectl get nodes
3.2 Annotation
查看Annotation
kubectl describe resource_type/resource_name
Annotation的添加与删除,#Key必须存在且唯一,Value可以为空、且不唯一
添加Annotation
kubectl annotate resource_type resource_name key=value
# 删除Annotation
kubectl annotate resource_type resource_name key-