添加临时标签
kubectl -n zy-test label po nginx-pod app=hello
使用标签查看pod
kubectl -n zy-test get po -A -l app=hello
使用标签查看pod,并且展示label属性
kubectl -n zy-test get po -A -l app=hello --show-labels
查看pod上的label详情
kubectl -n zy-test edit po nginx-pod
同一个标签匹配多个label值
kubectl -n zy-test get po -l 'app in (hello,test)'
多条件查询
kubectl -n zy-test get po -l 'app in (hello,test), type in (app)'
反向匹配
kubectl -n zy-test get po -l 'app!=test'