Closed haisum closed 3 years ago
We can pass MachineName decided by Rancher in vappProperties as guestinfo.machine.name to resolve this. In cloud-init one can fetch this info and set hostname/IP according to that. It's similar to approach defined here: https://pubs.vmware.com/esx254/admin/wwhelp/wwhimpl/common/html/wwhelp.htm?context=admin&file=esx25admin_vms.4.7.html . I can come up with a pull request if someone from Rancher team gives a go ahead.
This repository uses a bot to automatically label issues which have not had any activity (commit/comment/label) for 60 days. This helps us manage the community issues better. If the issue is still relevant, please add a comment to the issue so the bot can remove the label and we know it is still valid. If it is no longer relevant (or possibly fixed in the latest release), the bot will automatically close the issue in 14 days. Thank you for your contributions.
this is because you have enabled DHCP in your network profile. that's why each time your vm getting different IP address.
I am provisioning RKE cluster using vsphere cloud provider. I have a pool of IP addresses/hostnames defined in a network profile from which cluster nodes should be provisioned. I am passing vapp properties and using a cloud-init script to set up network interface. Can you please help me in figuring out how can I achieve following:
I expect to have cluster on vsphere such as:
But what I end up with is random allocation of ips like this:
Here's what my node template looks like with terraform:
Here's relevant section from cloud-config file:
Network profile looks like this:
Here, the problem is with
vmtoolsd --cmd 'info-get guestinfo.ovfEnv'
in cloud-config is getting random ips from range of ips defined in network profile. So I end up with something like this on vsphere:and on rancher UI:
Note in above that IP for phlaskubtstc2n3 is displayed as .160 but DNS server has
phlaskubtstc2n3 = 10.88.197.162
entry so if someone was to dossh phlaskubtstc2n3
they would end up at node which rancher and vsphere UI displays asphlaskubtstc2n2
. This is cause of confusion for end users. The work around is to have one node template per node and pass static ips/hostnames via those templates but it gets really ugly with high number of nodes.I would really appreciate if someone can help me with coming up with a solution which syncs ip/hostname on rancher and vSphere. One possible solution is to have rancher pass name of VM via guestinfo to guest OS. That way guest would know it's chosen to be host1 so should allocate IP1 to its' interface, but I couldn't find any way to do that.
What kind of request is this (question/bug/enhancement/feature request):
Question
Other details that may be helpful:
Environment information
rancher/rancher
/rancher/server
image tag or shown bottom left in the UI): v2.4.2Cluster information
kubectl version
):docker version
):