rancher / cluster-template-examples

Apache License 2.0
43 stars 127 forks source link

Node template example #6

Closed johnwc closed 2 years ago

johnwc commented 2 years ago

Need an example of using node templates. Specifically for us for vSphere.

bashofmann commented 2 years ago

The chart in this repo contains example for multiple infrastructure providers, including vsphere: https://github.com/rancher/cluster-template-examples/blob/main/charts/templates/nodeconfig-vsphere.yaml

johnwc commented 2 years ago

That is a example of a node template config, but not a RKE2 cluster config using the node template.

bashofmann commented 2 years ago

The machine configs are referenced in the cluster.yaml in the helm chart: https://github.com/rancher/cluster-template-examples/blob/main/charts/templates/cluster.yaml#L34-L46.

There is also a recording of a Kubernetes Master Class webinar, that goes into more details how RKE2 cluster templates work: https://www.youtube.com/watch?v=xXtOP7CHbSA.

johnwc commented 2 years ago

This still is not a feasible example of a RKE2 cluster.yaml using the node template. Expecting someone to go digging into a helm chart config script to find how to do it, is not documentation. This needs to be documented with an example cluster.yaml, or values.yaml for the chart.

guaychou commented 2 years ago

i need to embed the cloud init, do we have any documentation for this ?

bashofmann commented 2 years ago

There are some examples here on how to do it with Packer for different distributions: https://github.com/David-VTUK/Rancher-Packer. There is also a webinar that explains this https://www.youtube.com/watch?v=ozLPpyrqwf8. It's a bit older, but still largely relevant.

johnwc commented 2 years ago

There are some examples here on how to do it with Packer for different distributions: https://github.com/David-VTUK/Rancher-Packer. There is also a webinar that explains this https://www.youtube.com/watch?v=ozLPpyrqwf8. It's a bit older, but still largely relevant.

Again, not what was asked for. That is for manually creating a VM/image to be used within a node template.

slickwarren commented 2 years ago

sorry I'm not sure I'm understanding what it is that you're asking for. The way rke2 templates work is documented here at rancher.com. If you want to make custom changes (as you should in the long term), you can fork this repo and create your own templates based on whatever configuration you'd like and have setup in your vsphere environment.

johnwc commented 2 years ago

Where do you see to use a node template? The only template option it gives me, is for the image/template created within vmware.

image
slickwarren commented 2 years ago

it will be on the page before this, as a new option at the top of the page at cluster management -> clusters -> new

Screen Shot 2022-06-13 at 1 55 06 PM

in order to get templates to show up, you must create a repo through rancher (cluster management -> advanced -> new) that contains all of the templates you want to use. you can use this repo to get you started.

johnwc commented 2 years ago

I'm not trying to create a cluster template, I'm trying to use a node template that I created from the menu item on the left.

bashofmann commented 2 years ago

Node templates can only be used with RKE1 clusters. That's why the node templates are within the "RKE1 Configuration" section of the cluster manager

Bildschirmfoto 2022-06-14 um 10 28 35

At the moment RKE2 only has cluster templates. RKE2 cluster templates work completely differently to the RKE1 templating mechanism. RKE2 cluster templates are Helm charts that can container the Cluster specification as well as the MachinePool specifications or RBAC configurations.

How they work is documented at https://rancher.com/docs/rancher/v2.6/en/admin-settings/cluster-templates/#rke2-cluster-template. And this repository gives you an example how such a RKE2 cluster template looks like.

There is also a recording of a Kubernetes Master Class webinar, that goes into more details how RKE2 cluster templates work: https://www.youtube.com/watch?v=xXtOP7CHbSA.

It is currently not possible to reference an existing MachinePool specification from the UI when creating a new cluster. There are discussions about offering this functionality in the future, but this will need more work in is likely not going to happen before Rancher 2.7, more details: https://github.com/rancher/dashboard/issues/5981.

johnwc commented 2 years ago

Ahhh, my apologies! I didn't even notice the RKE1 prefix.

slickwarren commented 2 years ago

closing this based on the above comment.