与Azure ACS从本地计算机断开连接 [英] Disconnect with Azure ACS form Local Machine
问题描述
- 我已经使用以下命令提取了
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 withkubernetes machine
on Azure from my local machineaz 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屋!