tinkerbell / tink

Workflow Engine for provisioning Bare Metal
https://tinkerbell.org
Apache License 2.0
917 stars 134 forks source link

Add documentation for passing cloud-init metadata #110

Closed wangxin311 closed 1 year ago

wangxin311 commented 4 years ago

For service provisioning, customer need pass cloud-init info to create user/get package, etc. tink should handle cloud-init via metadata, but it's not clear on how to pass cloud-init data to metadata server and retrieve it during boot up.

displague commented 3 years ago

Cloud-init can use Hegel via the EC2 metadata support. See https://docs.tinkerbell.org/services/hegel

See https://cloudinit.readthedocs.io/en/latest/topics/datasources/ec2.html#configuration for how to configure custom metadata URLs.

As described in https://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html#datasource-nocloud, these values can be provided in the Kernel command line arguments:

ds=ec2;metadata_urls=http://{insert_hegel_ip_and_port}/

You can use a workflow like https://artifacthub.io/packages/tbaction/tinkerbell-community/kexec to provide a custom kernel argument (CMD_LINE).

Alternatively, with https://artifacthub.io/packages/tbaction/tinkerbell-community/writefile you can write a custom cloud.cfg file (https://cloudinit.readthedocs.io/en/latest/topics/faq.html#where-are-the-configuration-files) which defines the location of the metadata service, similar to https://github.com/tinkerbell/osie-og/blob/ebbe709e1f2b035fe2345e99a8d3aed77f2c22a4/docker/scripts/osie.sh#L298-L307.

You would want to replace metadata.packet.net with the Hegel address via templated workflows and variables (https://docs.tinkerbell.org/templates/ and https://docs.tinkerbell.org/workflows/working-with-workflows/#creating-a-workflow)).

displague commented 3 years ago

I think we can improve the documentation at https://docs.tinkerbell.org/services/hegel to more easily demonstrate how to do this.

Is that what you were looking for @wangxin311?

tstromberg commented 3 years ago

@nshalman has some experience with this

jacobweinstock commented 2 years ago

sounds like we could definitely use some help documenting how to integrate with cloud-init. Anyone out there that has done this or is interested in this?? We could most definitely use help creating this document.

chrisdoherty4 commented 1 year ago

There's an on-going documentation overhaul effort. I've added this as something for consideration. For more information please track https://github.com/tinkerbell/roadmap/issues/5.