在 kubectl 中,两者describe
and get -o <format>
可以用来获取资源的详细信息,我想知道两者有什么区别?为什么describe
即使存在,如果get
可以做同样的事情甚至更多吗?
-
kubectl get
默认显示表格。 (您可以轻松查看/可视化大量对象)
-
kubectl describe
显示详细说明。 (对于单个对象更好)
-
kubectl describe
比给出的完整对象数据更扁平,数据更少,更容易阅读kubectl get -o yaml
帮助输出供参考。
kubectl describe -h
Show details of a specific resource or group of resources
Print a detailed description of the selected resources, including related resources such as events or controllers. You
may select a single object by name, all objects of that type, provide a name prefix, or label selector. For example:
$ kubectl describe TYPE NAME_PREFIX
will first check for an exact match on TYPE and NAME_PREFIX. If no such resource exists, it will output details for
every resource that has a name prefixed with NAME_PREFIX.
Use "kubectl api-resources" for a complete list of supported resources.
kubectl get -h
Display one or many resources
Prints a table of the most important information about the specified resources. You can filter the list using a label
selector and the --selector flag. If the desired resource type is namespaced you will only see results in your current
namespace unless you pass --all-namespaces.
Uninitialized objects are not shown unless --include-uninitialized is passed.
By specifying the output as 'template' and providing a Go template as the value of the --template flag, you can filter
the attributes of the fetched resources.
Use "kubectl api-resources" for a complete list of supported resources.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)