/v1/ssh-keys is empty when deploying a private image

Hello,

I noticed that /v1/ssh-keys returns an empty value when booting a Linode image from a private image with a custom config.

core@172-234-24-26 ~ $ curl -H "Metadata-Token: $TOKEN" http://169.254.169.254/v1/ssh-keys

core@172-234-24-26 ~ $ curl -H "Metadata-Token: $TOKEN" http://169.254.169.254/v1/network
ipv4.public: 172.234.24.26/32
ipv6.link_local: fe80::f03c:94ff:fe1a:6760/128
ipv6.slaac: 2600:3c06::f03c:94ff:fe1a:6760/128

I created and booted the Linode by following those steps:

$ export REGION="us-ord"
$ linode-cli linodes create \
    --region "${REGION}" \
    --booted false \
    --type g6-nanode-1 \
    --metadata.user_data "$(base64 -w0 ignition.json)" \
    --label flatcar \
    --no-defaults
$ export LINODE_ID=$(linode-cli linodes list --label flatcar --json | jq -r '.[0].id')
$ linode-cli linodes config-create \
    --kernel linode/direct-disk \
    --helpers.updatedb_disabled true \
    --helpers.distro false \
    --helpers.modules_dep false \
    --helpers.network false \
    --helpers.devtmpfs_automount false \
    --label default \
    --devices.sda.disk_id "${DISK_ID}" \
    --root_device sda \
    "${LINODE_ID}"
$ linode-cli linodes boot "${LINODE_ID}"

I also tried to create the instance with --authorized_users $USER but same result. I have two public SSH keys on my account.

Thanks and let me know if you need more information.

Mathieu

2 Replies

I think first making sure that the SSH-keys are actually being added to the instance is the first step. I believe there are two places you can pass the ssh-keys to your server when creating it with the CLI.

Either it needs to be included in your cloud-config file discussed in this guide or by adding the param in the CLI call, as discussed in this guide.

Those linked resources provide examples of how to format the ssh-key in those specific situations. I'd recommend giving both of those methods a try and seeing if that helps.

Also, I confirmed I get the same result from the meta-data call you shared as I do when I run cat ~/.ssh/authorized_keys so checking that file to make sure the keys are there might be helpful.

Otherwise, it might be helpful to try to run the command from inside a server made from a cloud-init compatible public image just to see if only the private image is having problems. You can run linode-cli images list to see which images work with cloud-init.

Feel free to follow up if you're still struggling and share anything you learned when trying any of these steps.

Hi,

I uploaded a new-image with the cloud-init compatible flag and it worked. Thanks!

I think it's a bit counter-intuitive as the purpose of this kind of endpoint (/v1/ssh-keys) is to provide keys without initial provisioning (e.g cloud-init).

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct