I am passing (YAML representation)
metadata:
items:
- key: sshKeys
value: root:ssh-rsa AAAAB... non@nan
when creating a gcloud instance. But I cannot ssh to the instance
$ ssh 139.242.197.104.bc.googleusercontent.com
Host key fingerprint is SHA256:aSSOS1tMiF9h43C6UIJQW0TqXuYVMfRic3Lm7gYRECQ
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
Looks like ssh key is not inserted on boot. Instance is standard RHEL 7.2 kvm guest image converted from qcow2 to raw format and uploaded. Any idea if what I'm doing is the correct incantation for specifying ssh keys in GCE and if what I want is supported by cloud-init?
Huh, can't get any GCE answer it seems. Figured it out though. First of all current Red Hat Enterprise Linux (v7.2) cloud-init version does not support instance ssh keys (it handles only project level keys).
cloud-init
trunk though does support them already so hopefully downstream will pick up soon. In the meantime I used the followinguser-data
to emulate this (again YAML representation): metadata:Note that google documentation talks only about
startup-script
metadata key. To my reading even upstreamcloud-init
does not care about that metadata key. It is looking for theuser-data
key as shown above.Hope this helps.