代码之家  ›  专栏  ›  技术社区  ›  arshbot

kubectl如何列出所有上下文

  •  0
  • arshbot  · 技术社区  · 5 年前

    如何查看我与kubectl建立的所有上下文?

    库贝特尔似乎没有所谓的“上下文”资源

    $ kubectl get contexts
    error: the server doesn't have a resource type "contexts"
    
    2 回复  |  直到 5 年前
        1
  •  24
  •   arshbot    5 年前

    您可以通过config命令查看所有上下文

    $ kubectl config get-contexts
    
        2
  •  0
  •   prashant616    5 年前

    除了你的答案,你还可以用 kubectx 用于在集群和名称空间之间轻松切换的工具。