与Azure ACS从本地计算机断开连接 [英] Disconnect with Azure ACS form Local Machine

查看:86
本文介绍了与Azure ACS从本地计算机断开连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  • 我已经使用以下命令提取了azure acs凭据,并且可以从本地计算机与Azure上的kubernetes machine进行通信 az acs kubernetes get-credentials --resource-group=<cluster-resource-group> --name=<cluster-name>
  • 但是现在我想断开此连接,以便我的kubctl可以与其他计算机连接,它可以是本地计算机,也可以是任何其他计算机(我正在尝试与本地计算机连接).

  • I had pull my azure acs credentials using below command and I can communicate with kubernetes machine on Azure from my local machine az acs kubernetes get-credentials --resource-group=<cluster-resource-group> --name=<cluster-name>
  • But Now I wanted to disconnect this connection so that my kubctl can connect with other machine , it can be local or any other machine (I am trying to connect with local).

但是每次我运行kubectl command时,它都会与Azure ACS

But everytime I ran kubectl command it communicate with Azure ACS

推荐答案

对于您的方案,我们可以使用kubectl config use-context CONTEXT_NAME将默认集群切换到其他集群,这样我们就可以切换到另一个k8s集群.
我们可以使用此命令列出k8s上下文:

For your scenario, we can use kubectl config use-context CONTEXT_NAME to switch default cluster to others, in this way, we can switch to another k8s cluster.
We can use this command to list k8s contexts:

root@shui:~# kubectl config get-contexts
CURRENT   NAME               CLUSTER            AUTHINFO                 NAMESPACE
          jasontest321mgmt   jasontest321mgmt   jasontest321mgmt-admin   
*         jasonk8s321mgmt    jasonk8s321mgmt    jasonk8s321mgmt-admin   

指定k8s集群名称,我们可以使用以下命令kubectl config use-context CONTEXT_NAME:

Specify k8s cluster name, we can use this commandkubectl config use-context CONTEXT_NAME:

root@shui:~# kubectl config use-context -h
Sets the current-context in a kubeconfig file

Examples:
  # Use the context for the minikube cluster
  kubectl config use-context minikube

Usage:
  kubectl config use-context CONTEXT_NAME [options]

例如:

root@shui:~# kubectl config use-context jasontest321mgmt
Switched to context "jasontest321mgmt".

这篇关于与Azure ACS从本地计算机断开连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆