Skip to Content
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
Explore Skills
Cloud Computing
Microsoft Azure
Amazon Web Services (AWS)
Google Cloud
Cloud Migration
Cloud Deployment
Cloud Platforms
Data Engineering
Data Warehouse
SQL
Apache Spark
Microsoft SQL Server
MySQL
Kafka
Data Lake
Streaming & Messaging
NoSQL Databases
Relational Databases
Data Science
Pandas
R
MATLAB
SAS
D3
Power BI
Tableau
Statistics
Exploratory Data Analysis
Data Visualization
AI & ML
Generative AI
Machine Learning
Artificial Intelligence (AI)
Deep Learning
Reinforcement Learning
Natural Language Processing
TensorFlow
Scikit-Learn
Hyperparameter Tuning
MLOps
Programming Languages
Java
JavaScript
Spring
Python
Go
C#
C++
C
Swift
Rust
Functional Programming
Software Architecture
Object-Oriented
Distributed Systems
Domain-Driven Design
Architectural Patterns
IT/Ops
Kubernetes
Docker
GitHub
Terraform
Continuous Delivery
Continuous Integration
Database Administration
Computer Networking
Operating Systems
IT Certifications
Security
Network Security
Application Security
Incident Response
Zero Trust Model
Disaster Recovery
Penetration Testing / Ethical Hacking
Governance
Malware
Security Architecture
Security Engineering
Security Certifications
Design
Web Design
Graphic Design
Interaction Design
Film & Video
User Experience (UX)
Design Process
Design Tools
Business
Agile
Project Management
Product Management
Marketing
Human Resources
Finance
Team Management
Business Strategy
Digital Transformation
Organizational Leadership
Soft Skills
Professional Communication
Emotional Intelligence
Presentation Skills
Innovation
Critical Thinking
Public Speaking
Collaboration
Personal Productivity
Confidence / Motivation
Features
All features
Verifiable skills
AI Academy
Courses
Certifications
Interactive learning
Live events
Superstreams
Answers
Insights reporting
Radar Blog
Buy Courses
Plans
Sign In
Try Now
O'Reilly Platform
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即学即用(第二版)
54
|
第
4
章
4.5
给对象添加标签和注释
标签和注释是添加到对象的标记。我们将在第
6
章中讨论两者的差异。下面,
我们使用
annotate
和
label
命令来更新
Kubernetes
对象上的标签和注释。例
如,如果你想将标签
color=red
添加到名为
bar
的
Pod
中,则可以运行:
$
kubectl label pods bar color=red
注释的语法与之完全相同。
默认情况下,
label
和
annotate
不允许覆盖已有的标签。如果想覆盖已有的
标签,则需要添加
--overwrite
标志。
如果想移除标签,则可以使用
<
标签名称
>-
的语法:
$
kubectl label pods bar color-
这个命令将删除
bar
POD
上的
color
标签。
4.6
调试命令
另外,
kubectl
还提供了许多调试容器的命令。你可以通过以下命令查看正在
运行的容器的日志:
$
kubectl logs <Pod
名称
>
如果
Pod
中有多个容器,则可以使用
-c
标志选择要查看的容器。
默认情况下,
kubectl
logs
会列出当前日志并退出。如果你想将日志流不间
断地输出到终端,则可以在命令行中添加
-f
(
follow
)标志。
此外,你还可以使用
exec
命令,在运行的容器中执行命令:
$
kubectl exec -it <Pod
名称
> -- bash
常用的
kubectl
命令
|
55
这个命令可以在容器内部启动一个交互式
shell
,供你执行更多调试。
如果容器中没有安装
bash
或其他终端,你还可以通过
attach
命令,将终端 ...
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深度学习
Posts & Telecom Press, Vishnu Subramanian
Python数据分析
Posts & Telecom Press, Ivan Idris
Python贝叶斯分析(第2版)
Posts & Telecom Press, Osvaldo Martin
Python高级编程(第2版)
Posts & Telecom Press, Michał Jaworski, Tarek Ziadé
Publisher Resources
ISBN: 9787519856762