如何从 kubectl 访问节点

How to access a node from kubectl

在这个 doc 中,他们使用 u@node$ 来定义命令是从集群中的节点完成的。但是怎么从kubectl到节点呢?

详细描述了如何到达 pod u@pod$

apiserver 可以用作 HTTP 代理(如 here 所述)以访问节点上的端点,但我假设您需要一个 SSH 会话,这无济于事。

在 GKE 上,您可以使用 gcloud 通过 SSH 连接到您的节点,如下所示:

  • gcloud compute instances list
  • gcloud compute ssh <nodeName>

在 GKE 上,您只需 select 您的集群并单击 SSH 按钮。如果来自命令行,则:

gcloud compute ssh NODE --zone ZONE