Terraform code to provision K8s clusters in vSphere with Rancher 2.x. VMs are created by cloning from a RancherOS template. A cloud-config template is used to provide nodes with static IP addresses and other configuration.
- Clone the Rancher2 Terraform provider from https://github.com/rancher/terraform-provider-rancher2.
- Build the provider binary by running
make bin
- Copy the provider binary to a local path, e.g.
cp ./terraform-provider-rancher2 /usr/local/bin/
- Download the RancherOS OVA appliance from: -TODO-
- Import into vSphere ("Deploy OVF template...)
- Mark the resulting VM as template ("Convert to template")
- Note the name/path of the template which must be provided to Terraform
You may also use the existing template in the Fremont vCenter: vm-templates/rancheros-v1.4.0-golden
.
- Copy the
terraform.tfvars.example
toterraform.tfvars
and adapt to match your environment - Specify the static IP configuration for the nodes (
masters_static_ips
,workers_static_ips
,guest_default_gateway
) - Adapt the cloud-config template (
files/cloud-config.tpl
) to your needs - Run
terraform plan
- Run
terraform apply