https://rancher.com/ logo
b

boundless-dog-9864

06/06/2022, 4:36 PM
Hi all. Does anyone have any hints about getting rke2 provisioning working on. Vsphere without DHCP? The rancher2_machine_config_v2 resource looks like the way to go but the docs and examples are very thin on the ground.
a

agreeable-oil-87482

06/06/2022, 6:21 PM
The
cluster_v2
resource is what you're after which references the machine config. The docs have examples for EC2 iirc but if you want to use vSphere here's an example I'm working on (for NSX-T) https://github.com/David-VTUK/rke2-nsxt-terraform/blob/f6dfa18951ad85235734babad363a8b6375d1e80/modules/rancher/main.tf#L5-L43 As for not using DHCP you can either use custom scripting on a per machine pool basis or use something like vapp pools: https://www.virtualthoughts.co.uk/2020/03/29/rancher-vsphere-network-protocol-profiles-and-static-ip-addresses-for-k8s-nodes/ - I wrote this for RKE1 but the same applies to RKE2.
b

boundless-dog-9864

06/06/2022, 6:24 PM
Thank you. The custom script route you mentioned. Is that possible with the cloud_config parameter from your example to drive the VMware user data?
a

agreeable-oil-87482

06/06/2022, 6:25 PM
Yeah the cloud config references yaml that's ingested as
user-data
on first boot on the target vm
b

boundless-dog-9864

06/06/2022, 6:27 PM
I see. So you could template that yaml in terraform. Although it looks like it's a yaml file per node pool so how would you give machines unique hostname and ip
a

agreeable-oil-87482

06/06/2022, 6:27 PM
You'd have to have a 1:1 config per node which isn't great.
Pretty much everyone I've spoken to running vSphere clusters without DHCP are using the vapp method
b

boundless-dog-9864

06/06/2022, 6:28 PM
Also. Obviously no dockermachine or anything needed with rke2 but are there any other pre reqs? We can provision cluster nodes on a standard rhel 8 machine using the registration command at the moment.
a

agreeable-oil-87482

06/06/2022, 6:32 PM
Nothing overly specific, we've validated it against RHEL 8.5. For the e2e provisioning from Rancher you'd need cloud init installed and cleared before turning it into a template.
b

boundless-dog-9864

06/06/2022, 6:39 PM
Ok cool. Stand-alone terraform is working ok with cloud init so should be good I think. 8.4 but let's see how it goes
16 Views