Skip to Content
Kubernetes即学即用(第二版)
book

Kubernetes即学即用(第二版)

by Brendan Burns, Joe Beda, Kelsey Hightower
June 2021
Intermediate to advanced
300 pages
5h 4m
Chinese
China Electric Power Press Ltd.
Content preview from Kubernetes即学即用(第二版)
84
6
如果想删除标签,只需在标签最后加上减号(
-
):
$
kubectl label deployments alpaca-test "canary-"
6.1.3
标签选择器
标签选择器的用途是根据一组标签过滤
Kubernetes
对象。选择器使用简单的
布尔语言。最终用户(通过
kubectl
等工具)和各种类型的对象(例如表示
副本集与
Pod
的关系)都可以使用标签选择器。
每个部署(通过副本集)都会使用标签创建一组
Pod
,而这些标签是在嵌入
到部署的模板中指定的,可通过
kubectl run
命令配置。
kubectl get pods
命令会返回当前集群中运行的所有
Pod
。在我们的三个环
境中,一共有
6
kuard Pod
$
kubectl get pods --show-labels
NAME ... LABELS
alpaca-prod-3408831585-4nzfb ... app=alpaca,env=prod,ver=1,...
alpaca-prod-3408831585-kga0a ... app=alpaca,env=prod,ver=1,...
alpaca-test-1004512375-3r1m5 ... app=alpaca,env=test,ver=2,...
bandicoot-prod-373860099-0t1gp ... app=bandicoot,env=prod,ver=2,...
bandicoot-prod-373860099-k2wcf ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

PyTorch深度学习

PyTorch深度学习

Posts & Telecom Press, Vishnu Subramanian
Python数据分析

Python数据分析

Posts & Telecom Press, Ivan Idris
Python贝叶斯分析(第2版)

Python贝叶斯分析(第2版)

Posts & Telecom Press, Osvaldo Martin
Python高级编程(第2版)

Python高级编程(第2版)

Posts & Telecom Press, Michał Jaworski, Tarek Ziadé

Publisher Resources

ISBN: 9787519856762