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即学即用(第二版)
66
5
5.4.3
删除
Pod
你可以利用
Pod
的名称删除
Pod
$
kubectl delete pods/kuard
或者使用创建
Pod
时的同一个文件来删除
Pod
$
kubectl delete -f kuard-pod.yaml
删除
Pod
时,
Pod
不会立即被干掉。如果你运行
kubectl get pods
,则可以
看到该
Pod
处于
Terminating
状态。所有
Pod
都有终止宽限期,默认为
30
秒。
进入
Terminating
状态的
Pod
不会再接收新请求。在提供服务的时候,宽限
期对于可靠性很重要,因为宽限期允许
Pod
在终止之前,完成所有正在处理
的活动请求。
请注意,删除
Pod
的时候,存储在相关容器中的所有数据也会被删除。如果
你想让
Pod
跨多个实例持久保存数据,则需要使用持久卷,具体内容请见本
章末尾。
5.5
访问
Pod
现在,
Pod
正在运行,由于各种原因,你需要访问它。比如你想加载
Pod
运行的
Web
服务,或者你想通过
Pod
的日志调试遇到的问题,甚至希望在
Pod
上下文中执行其他命令来辅助调试。以下各节详细介绍了与
Pod
内部运
行的代码和数据进行交互的各种方式。
5.5.1
使用端口转发
在本书后面的章节中,我们将介绍如何通过负载均衡向外或其他容器公开服
务,但你经常需要访问某个特定的
Pod
,即使这个
Pod
并不向互联网提供服务。
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