Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Problem adding ssh key to metadata

Hello Everyone

I am having problems adding a public key to metadata. My entry looks like this:

 

 

ssh-rsa AAAAB3N..........== jenkins

 

 

On the add item page I am told that the format of my entry is invalid and that it should be:

 

 

<protocol> <key-blob> <username@example.com>

 

 

But when looking at a username example at the following link:

https://cloud.google.com/compute/docs/connect/add-ssh-keys#metadata 

It gives me the impression that the username doesn't have to be followed by @domain.com.

The problem for me with specifying a username@domain.com is that I have Jenkins set up as a master node on my laptop that has been configured to work with the Google Compute Engine plugin where an instance template has been specified to autogenerate VM instances that act as Jenkins agent nodes whenever the build process is initiated. The master node has been configured to connect to the agent nodes using a user called jenkins. Since the VM instances are autogenerated, I wouldn't know what their IPs are before hand in order to be able to specify a jenkins@ip_of_vm_instance in the sssh key item I want to add to metadata. Please any pointers on how to resolve this problem will be greatly appreciated.

0 4 2,356
4 REPLIES 4

Hi,

It should work, probably you have a problem with the key string - for example, copy string from another window with end of line separators

Best regards

Andrew

Sorry Andrew forgive me. Are you suggesting I end my entry with a new line character like this:

<protocol> <key-blob> <username> \n

Thank you for your help. Regards

Hello imonike,

Welcome to Google Cloud Community!

You may also use this document where everything is explained in detail. 

See Adding private SSH-keys to your GCP project

Thanks Willbin. I have actually gone through this before. The link I posted in my original statement of the problem comes from there.