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即学即用(第二版)
常用的
kubectl
命令
51
在的位置以及身份验证所需的信息。例如,你可以通过以下命令,创建一个
拥有不同默认命名空间的上下文,供
kubectl
命令使用:
$
kubectl config set-context my-context --namespace=mystuff
该命令会创建一个新的上下文,但并不会实际投入使用。如果想使用这个新
创建的上下文,则需运行如下命令:
$
kubectl config use-context my-context
此外,我们还可以利用上下文来管理多个集群或针对多个用户进行身份认证,
方法是在
set-context
命令中指定
--users
--clusters
标志。
4.3
查看
Kubernetes API
对象
Kubernetes
中包含的一切都由
RESTful
资源表示。在本书中,我们称这些资
源为
Kubernetes
对象。每个
Kubernetes
对象都拥有唯一的
HTTP
路径。例如,
https://your-k8s.com/api/v1/namespaces/default/pods/my-pod
代表了默认命名空
间中一个名叫
my-pod
Pod
kubectl
命令可以向这些
URL
发送
HTTP
请求,
访问这些路径表示的
Kubernetes
对象。
通过
kubectl
查看
Kubernetes
对象的最基本命令是
get
。如果运行
kubectl
get <
资源名称
>
,则可以获得当前命名空间中所有资源的清单。如果想获取
特定资源,则可以使用
kubectl get <
资源名称 ...
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