2015-11-11 93 views
2

我想從谷歌雲中使用gcloud compute ssh命令從另一個虛擬機ssh進入ssh。它與以下消息失敗:gcloud從一個虛擬機計算ssh到另一個虛擬機在谷歌雲上

/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/compute/lib/base_classes.py:9: DeprecationWarning: the sets module is deprecated 
    import sets 

Connection timed out 
ERROR: (gcloud.compute.ssh) [/usr/bin/ssh] exited with return code [255]. See https://cloud.google.com/compute/docs/troubleshooting#ssherrors for troubleshooting hints. 

我確保ssh密鑰已到位,但它仍然無法正常工作。我在這裏錯過了什麼?

回答

2

嗨這裏有這個網站來完成這個步驟上...

本節假定您已連接到使用SSH事先與gcloud外部可見的實例。

從本地機器上,啓動的ssh-agent使用以下命令來管理你的鑰匙給你:

[email protected]:~$ eval `ssh-agent` 

呼叫SSH-添加加載gcloud計算公共密鑰從本地計算機到代理,同時提供了-A參數,允許認證代理轉發

[email protected]:~$ ssh-add ~/.ssh/google_compute_engine 

登錄到一個實例與外部IP地址:並用它們爲所有SSH命令進行身份驗證。

gcloud compute ssh --ssh-flag="-A" INSTANCE 

來源:https://cloud.google.com/compute/docs/instances/connecting-to-instance#sshbetweeninstances

我不確定'旗',因爲它不適用於我不知道我可能有不同的操作系統或Gcloud版本,它會爲你工作。

+0

在MacOS,我可以證實了以下工作:(1)添加'SSH-添加的〜/ .ssh/google_compute_engine'。 (2)'gcloud compute --project「」ssh --zone「us-west1-a」--ssh-flag =「 - A」「」' –

1

以下是我在我的Mac上運行的連接到Google Dataproc主虛擬機,然後從主MV跳到工作虛擬機上的步驟。我ssh'd主VM獲取IP。

$ gcloud compute ssh cluster-for-cameron-m Warning: Permanently added '104.197.45.35' (ECDSA) to the list of known hosts.

我再exit版。我啓用了該主機的轉發。

$ nano ~/.ssh/config

Host 104.197.45.35 ForwardAgent yes

我增加了gcloud關鍵。 $ ssh-add ~/.ssh/google_compute_engine

然後我通過列出關鍵指紋ssh-add -l驗證它是否被添加。我重新連接到主虛擬機,並再次運行ssh-add -l以驗證密鑰確實已轉發。之後,連接到工作節點工作得很好。

ssh cluster-for-cameron-w-0

相關問題