Reputation: 93
I want to execute a script which is in my compute engine using cloudbuild but somehow cloudbuild is not able to ssh into my vm , in my vm "OS LOGIN" is enabled and also have only internal ip.
here is my cloudbuild.yaml file
steps:
- name: 'gcr.io/cloud-builders/gcloud' id: Update staging server entrypoint: /bin/sh args:
- '-c'
- | set -x &&
gcloud compute ssh vm_name --zone=us-central1-c --command='/bin/sh /pullscripts/pull.sh'
I am attaching my error pics
Also my question is , is it possible connect a vm using cloud sdk if "os login" is enabled.
Upvotes: 0
Views: 1022
Reputation: 329
Try adding --internal-ip
which looks like as follows:
gcloud compute ssh vm_name --zone=us-central1-c --internal-ip
Upvotes: 0
Reputation: 51
in fact, you can use gcloudbuild to connect in any vm, just need a docker configuration and upload the files (private_key, scripts, etc). I've this repo to solve this problem: https://github.com/jmbl1685/gcloudbuild-vm-ssh-connect
I hope that the above help you
Upvotes: 0
Reputation: 14669
You'll probably have to add the roles/iap.tunnelResourceAccessor
role to the cloudbuild service account. Please read this Google documentation, which shows you what to do with a certain error code.
Error code 4033
Either you don't have permission to access the instance, the instance doesn't exist, or the instance is stopped.
Upvotes: 4