无法通过 SSH 连接到曾经正常工作的 GCP 虚拟机实例

Cannot SSH into the GCP VM instances that used to work

我昨天创建了几个 GCP VM 实例,它们都使用相同的配置,但 运行 执行不同的任务。 我可以通过 GCP 控制台 SSH 进入这些实例,它们都运行良好。
今天我想检查任务是否完成,但我无法再通过浏览器 SSH 进入任何这些实例...错误消息如下:

Connection via Cloud Identity-Aware Proxy Failed
Code: 4010
Reason: destination read failed
You may be able to connect without using the Cloud Identity-Aware Proxy.

所以我在禁用 Cloud Identity-Award 代理的情况下重试。但随后它显示:

Connection Failed
An error occurred while communicating with the SSH server. Check the server and the network configuration.

运行

gcloud compute instances list

显示了我所有的实例,状态为RUNNING。 但是当我 运行

gcloud compute instances get-serial-port-output [instance-name]

使用上述命令返回的 [instance-name]。 (这是为了检查实例的启动盘是否有运行 out of free space。) 它返回

(gcloud.compute.instances.get-serial-port-output) Could not fetch serial port output: The resource '...' was not found

一些额外信息:
我正在从同一个互联网(我的家庭互联网)访问虚拟机实例,其他一切都一样
我是项目的所有者
我的帐户正在使用 GCP 免费试用,信用额度为 300 美元
这些实例的机器类型为 c2-standard-4,并且正在使用 Linux 深度学习
gcloud 配置对我来说很合适:

$ gcloud config list
[component_manager]
disable_update_check = True
[compute]
gce_metadata_read_timeout_sec = 5
[core]
account = [my_account]
disable_usage_reporting = True
project = [my_project]
[metrics]
environment = devshell

更新:
我重置了其中一个实例,现在我可以成功通过 SSH 连接到该实例。但是实例上的作业 运行ning 在重置后停止。
我想在其他实例上保留作业 运行ning。有没有办法在不重置的情况下通过 SSH 连接到其他实例?

您的问题出在虚拟机端。您的任务是 运行 使 ssh 服务无法接受传入连接,只有在重新启动后您才能连接。

您应该能够看到实例的 serial console output using gcloud compute instances get-serial-port-output [instance-name] but if for some reason you're not You may try instead using GCP console - go to the instance's details and click on Serial port 1 (console) 并且您将看到输出。

你甚至可以 interact with your VM (login) via the console。如果某些东西停止了 ssh 服务但为此您需要 login/password,这将特别有用,因此首先您必须访问 VM 或使用启动脚本使用您的密码添加用户。但话说回来 - 这需要重新启动。

无论哪种情况,重启虚拟机似乎都是最佳选择。但是您可以通过检查日志来尝试找出导致 ssh 服务在一段时间后停止的原因。或者您可以使用 crondf -Th /mountpoint/path | tail -n1 >> /name_of_the_log_file.log.

创建您自己的(磁盘 space、内存、cpu 等)

例如,您可以使用 cron 来检查和启动 ssh 服务。

如果某些东西没有按预期工作(根据文档)- 转到 IssueTracker 并创建一个新问题以获得更多帮助。