SSH key 생성

gcloud compute ssh <노드 이름>

위 명령어를 실행하면 아래 경로에 key가 생성됨. $HOME/.ssh/ 경로에 다른 키가 없어야 함

생성된$HOME/.ssh/google_compute_engine.pub 끝부분에 보면 이미 username:PC name이 적혀있다. 여기서 username만 복사해서 맨 앞에 :와 함께 붙여준다.

username**(수정한 부분)**:ssh-rsa ... [email protected]

노드에 SSH Key 추가

gcloud compute instances add-metadata <노드 이름> --metadata-from-file ssh-keys=$HOME/.ssh/google_compute_engine.pub

노드 외부 IP 얻기

gcloud compute instances describe <노드 이름>

natIP가 외부 ip임

SSH 접속하기

ssh -i $HOME/.ssh/google_compute_engine username@외부ip