【问题标题】:How to connect from local kubectl to a remote kubernetes cluster?如何从本地 kubectl 连接到远程 kubernetes 集群?
【发布时间】:2016-04-06 13:32:45
【问题描述】:

我已经使用指南http://kubernetes.io/v1.1/docs/getting-started-guides/coreos/azure/README.html 在 Azure Cloud(使用 CoreOS)中配置了 kubernetes 集群

它工作正常,现在我想从我的本地机器(我使用 Mac)运行 kubectl 命令。为此,我使用 brew 安装了 kubernetes-cli,但无法连接到远程 kubernetes 集群。当我运行“kubectl 版本”时,

user$  kubectl version 
Client Version: version.Info{Major:"1", Minor:"1",GitVersion:"v1.1.2+3085895",GitCommit:"3085895b8a70a3d985e9320a098e74f545546171",GitTreeState:"not a git tree"} 
error: couldn't read version from server: Get http://localhost:8080/api: dial tcp [::1]:8080: getsockopt: connection refused

如何通过SSH等方式连接kubernetes集群?

注意:我可以手动 ssh 到 kubernetes 节点并在那里运行 kubectl 命令。

【问题讨论】:

    标签: kubernetes coreos


    【解决方案1】:

    Sharing Cluster Access 中描述了复制远程访问集群所需的配置文件的机制。如果 ~/.kube/config 包含无法远程访问的端点(不可路由的 IP)和/或打开对 Azure 中运行的 apiserver 的防火墙访问,则您可能需要在复制后手动调整 ~/.kube/config。否则,一旦你获得了本地配置文件,你应该已经准备好了。

    【讨论】:

      猜你喜欢
      • 2020-06-05
      • 1970-01-01
      • 2018-10-22
      • 2017-02-28
      • 2018-12-28
      • 2023-01-30
      • 1970-01-01
      • 1970-01-01
      • 2019-07-27
      相关资源
      最近更新 更多