与 kubectl 一起使用时,mobaxterm 无法读取 kube 配置设置?
mobaxterm is not able to read kube config setting when using with kubectl?
我正在使用 MobaXterm_21.2
安装版。
当我 运行 kubectl version
时,它按预期工作:
kubectl version
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.3", GitCommit:"5e53fd6bc17c0dec8434817e69b04a25d8ae0ff0", GitTreeState:"clean", BuildDate:"2019-06-06T01:44:30Z", G
oVersion:"go1.12.5", Compiler:"gc", Platform:"windows/amd64"}
Unable to connect to the server: dial tcp [::1]:8080: connectex: No connection could be made because the target machine actively refused it.
但它无法读取 .kube/config
文件或无法获取通过 ENV 变量 KUBECONFIG
或 --kubeconfig
给出的配置文件。请参阅以下回复:
export KUBECONFIG=/drives/path/to/config/file.config
✔
kubectl config view
apiVersion: v1
clusters: []
contexts: []
current-context: ""
kind: Config
preferences: {}
users: []
也不工作:
kubectl config --kubeconfig=/drives/path/to/config/file.config view
apiVersion: v1
clusters: []
contexts: []
current-context: ""
kind: Config
preferences: {}
users: []
这对我来说是一种阻塞问题。谁能指导我如何使 kubectl
在 mobaxterm 中工作?任何帮助将不胜感激。
编辑 - 就像@mikolaj-s 指出的那样。从 powershel/cmd/gitbash
,我可以毫无问题地访问 k8s 集群。几个月来我一直在使用 powershell 访问集群,它按预期读取 .kube/config
文件或 KUBECONFIG
env var。
我想转向 mobaxterm,因为它具有多选项卡功能。如果有其他工具提供多选项卡功能,我也可以接受。
在 Mobaxterm 中 -
kubectl cluster-info dump
Unable to connect to the server: dial tcp [::1]:8080: connectex: No connection could be made because the target machine actively refused it.
kubectl config get-contexts --kubeconfig /path/to/config/file
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
我使用的 kubeconfig 文件已经过测试,并且肯定没有问题(100%),因为它们在 powershell 中工作。
编辑 2 -非常感谢@mikolaj-s。
满怀希望,我尝试按照 mikolaj 的建议在 mobaxterm 中使用 powershell - mobaxterm-windows-command-prompt 和 它起作用了。
解决方案是直接在 MobaXterm 中使用 PowerShell - 如何配置的步骤可以是 found here(而不是 CMD
选择 Powershell
):
MobaXterm comes with various client tools such as SSH, telnet, WSL, CMD, and so on. It can well handle a Windows command line as well, here is how,
How to open Windows command prompt using MobaXterm?
- Open your MobaXterm
- From the top menu, click on Sessions
- From the Session settings window, click on the Shell button
- Under the Basic Shell settings tab, select Terminal shell CMD
- Also select a startup directory of your choice, which the CMD prompt will start it as you startup folder.
- Now, Click the OK button to open a windows command window!
With this, you should be able to use multiple Windows command lines in a tabbed view, or along with your other sessions.
我正在使用 MobaXterm_21.2
安装版。
当我 运行 kubectl version
时,它按预期工作:
kubectl version
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.3", GitCommit:"5e53fd6bc17c0dec8434817e69b04a25d8ae0ff0", GitTreeState:"clean", BuildDate:"2019-06-06T01:44:30Z", G
oVersion:"go1.12.5", Compiler:"gc", Platform:"windows/amd64"}
Unable to connect to the server: dial tcp [::1]:8080: connectex: No connection could be made because the target machine actively refused it.
但它无法读取 .kube/config
文件或无法获取通过 ENV 变量 KUBECONFIG
或 --kubeconfig
给出的配置文件。请参阅以下回复:
export KUBECONFIG=/drives/path/to/config/file.config
✔
kubectl config view
apiVersion: v1
clusters: []
contexts: []
current-context: ""
kind: Config
preferences: {}
users: []
也不工作:
kubectl config --kubeconfig=/drives/path/to/config/file.config view
apiVersion: v1
clusters: []
contexts: []
current-context: ""
kind: Config
preferences: {}
users: []
这对我来说是一种阻塞问题。谁能指导我如何使 kubectl
在 mobaxterm 中工作?任何帮助将不胜感激。
编辑 - 就像@mikolaj-s 指出的那样。从 powershel/cmd/gitbash
,我可以毫无问题地访问 k8s 集群。几个月来我一直在使用 powershell 访问集群,它按预期读取 .kube/config
文件或 KUBECONFIG
env var。
我想转向 mobaxterm,因为它具有多选项卡功能。如果有其他工具提供多选项卡功能,我也可以接受。
在 Mobaxterm 中 -
kubectl cluster-info dump
Unable to connect to the server: dial tcp [::1]:8080: connectex: No connection could be made because the target machine actively refused it.
kubectl config get-contexts --kubeconfig /path/to/config/file
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
我使用的 kubeconfig 文件已经过测试,并且肯定没有问题(100%),因为它们在 powershell 中工作。
编辑 2 -非常感谢@mikolaj-s。
满怀希望,我尝试按照 mikolaj 的建议在 mobaxterm 中使用 powershell - mobaxterm-windows-command-prompt 和 它起作用了。
解决方案是直接在 MobaXterm 中使用 PowerShell - 如何配置的步骤可以是 found here(而不是 CMD
选择 Powershell
):
MobaXterm comes with various client tools such as SSH, telnet, WSL, CMD, and so on. It can well handle a Windows command line as well, here is how,
How to open Windows command prompt using MobaXterm?
- Open your MobaXterm
- From the top menu, click on Sessions
- From the Session settings window, click on the Shell button
- Under the Basic Shell settings tab, select Terminal shell CMD
- Also select a startup directory of your choice, which the CMD prompt will start it as you startup folder.
- Now, Click the OK button to open a windows command window!
With this, you should be able to use multiple Windows command lines in a tabbed view, or along with your other sessions.