kubectl config get-contexts 和自定义列输出
kubectl config get-contexts and custom-columns output
我希望kubectl config get-contexts
显示默认输出中显示的所有列或任意子集。
目前,kubectl config get-contexts
显示 CURRENT NAME CLUSTER AUTHINFO
和 NAMESPACE
。在我的终端上,总共有 221 列,NAME
、CLUSTER
和 AUTHINFO
对于所有上下文都是相同的。
kubectl config get-contexts
文档仅显示一个输出选项:-o=name
。尝试用 -o=custom-columns="CURRENT:.metadata.current,NAME:.metadata.name"
(例如)覆盖它会导致错误。
我是不是做错了什么,或者 kubectl get
常见的 custom-columns
选项是一个缺失的功能?
更新: 维护者认为没有干净的方式来实现输出选项;见 https://github.com/kubernetes/kubectl/issues/1052
如错误消息所示:
error: output must be one of '' or 'name'
并在 the docs 中描述:
output o Output format. One of: name
只有 name
的值可以与 kubectl config get-contexts
的 custom-columns 选项一起使用。
您剩下的另一个选项是列出当前上下文:
kubectl config current-context
我希望kubectl config get-contexts
显示默认输出中显示的所有列或任意子集。
目前,kubectl config get-contexts
显示 CURRENT NAME CLUSTER AUTHINFO
和 NAMESPACE
。在我的终端上,总共有 221 列,NAME
、CLUSTER
和 AUTHINFO
对于所有上下文都是相同的。
kubectl config get-contexts
文档仅显示一个输出选项:-o=name
。尝试用 -o=custom-columns="CURRENT:.metadata.current,NAME:.metadata.name"
(例如)覆盖它会导致错误。
我是不是做错了什么,或者 kubectl get
常见的 custom-columns
选项是一个缺失的功能?
更新: 维护者认为没有干净的方式来实现输出选项;见 https://github.com/kubernetes/kubectl/issues/1052
如错误消息所示:
error: output must be one of '' or 'name'
并在 the docs 中描述:
output o Output format. One of: name
只有 name
的值可以与 kubectl config get-contexts
的 custom-columns 选项一起使用。
您剩下的另一个选项是列出当前上下文:
kubectl config current-context