Disconnect with Azure ACS form Local Machine

╄→尐↘猪︶ㄣ 提交于 2019-12-12 05:26:42

问题


  • 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).

  • But everytime I ran kubectl command it communicate with Azure ACS


回答1:


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   

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]

For example:

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


来源:https://stackoverflow.com/questions/44195652/disconnect-with-azure-acs-form-local-machine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!