Rancher vSphere cluster provisioning with static host ip

Hi,

is it possible to deploy an rke-cluster via v-sphere cluster provisioning with static ips?

I’ve set up the rancher/vsphere integration via the docs: https://rancher.com/docs/rancher/v2.x/en/cluster-provisioning/rke-clusters/node-pools/vsphere/provisioning-vsphere-clusters/

I have created a vSphere Template from a CentOS vm. There I didn’t set up any IP configs, because I want Rancher/Cloud-Init to set up a static IP configuration.

In the “Node Template” I selected “Deploy from Template: Data Center” as creation method and selcetd my previous created template.

After that I provided following Cloud-Init config:

  1. Version
    #cloud-config
    hostname: ranchervm
    config:
    user.network-config: |
    version: 1
    config:
    - type: physical
    name: ens192
    subnets:
    - type: static
    ipv4: true
    address: 20.201.12.99
    netmask: 255.255.252.0
    gateway: 20.201.12.2
    control: auto
    - type: nameserver
    address:
    - 20.1.100.1
    - 8.8.8.8
  2. Version
    #cloud-config
    hostname: ranchervm
    network:
    version: 1
    config:
    - type: physical
    name: ens192
    subnets:
    - type: static
    address: 20.201.12.99/22
    gateway: 20.201.12.2
    - type: nameserver:
    address:
    - 20.1.100.1
    - 8.8.8.8

Now if I create a new cluster with this node template, the vm is created correctly.
If I log on the vm I see that the hostname changed to the new one, but the IP configuration is set to dhcp.

Any ideas what I am doing wrong?

Hi,

Any update on this? We have almost the same problem.Did you solved this?

Regards,
Snoopenz

because in cloud-init, userdata does not change network configuration.

User-data cannot change an instance’s network configuration. In the absence of network configuration in any of the above sources , Cloud-init will write out a network configuration that will issue a DHCP request on a “first” network interface.