Disconnect with Azure ACS form Local Machine

5/26/2017
  • 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

-- user5594493
azure
azure-virtual-machine
kubectl
kubernetes

1 Answer

5/26/2017

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".
-- Jason Ye
Source: StackOverflow