gpt4 book ai didi

kubernetes - 如何描述kubernetes资源

转载 作者:行者123 更新时间:2023-12-02 12:14:44 25 4
gpt4 key购买 nike

我正在尝试获取给定kubernetes资源的元数据。类似于REST端点的describe

是否有kubectl可以获取我可以为任何k8s资源提供的所有可能的东西?

例如,对于部署资源,可能是这样的。

apiVersion: apps/v1
kind: Deployment
metadata:
name: <type:String>
<desc: name for the deployment>
namespace: <type:String>
<desc: Valid namespace>
annotations:
...

提前致谢 !

最佳答案

您可以使用kubectl explain CLI命令:

This command describes the fields associated with each supported API resource. Fields are identified via a simple JSONPath identifier:

<type>.<fieldName>[.<fieldName>]

Add the --recursive flag to display all of the fields at once without descriptions. Information about each field is retrieved from the server in OpenAPI format.



查看所有与部署相关的字段的示例:
kubectl explain deployment --recursive
您可以深入研究特定 Realm :
kubectl explain deployment.spec.template
您还可以依赖 Kubernetes API Reference Docs

关于kubernetes - 如何描述kubernetes资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58491673/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com