Rancheros ignore the static IP i set in cloud-config.yml

Hi everybody,

I am sorry to ask a question as naive, but i cannot set a fix IP on my RancherOS instance. It always retrieves an address from the DHCP…

my configuration:
RancherOS v0.8.0-rc2 on a VMware infrastructure. i use Linux VMware Workstation to connect on RancherOS consoles.

my cloud-config.yml file:

#cloud-config
rancher:
  network:
    dns:
      nameservers:
        - 172.20.74.140
        - 8.8.8.8
        - 8.8.4.4
    interfaces:
      eth0:
        address: 172.20.74.148/24
        gateway: 172.20.74.254
        mtu: 1500
        dhcp: false
      lo:
        address: 127.0.0.1/8
ssh_authorized_keys:
  - ssh-dss AAAA...Y22zR echiarello@service-info12

as explained in https://docs.rancher.com/os/running-rancheros/server/install-to-disk/ this file is copied/pasted from my Linux workstation in the RancherOS console, with the vi command. (it should be noticed that i would prefer a french keyboard, azerty instead of qwerty…but it is not insurmountable).

the problem:
after installation (sudo ros install -c cloud-config.yml -d /dev/sda) and reboot, the host has not the IP address I just set : 172.20.74.148. the IP is now 172.20.74.252, retrieved fom DHCP.

it seems to me that the cloud-config.yml file is not used… and i cannot connect to the host to see its logs…

just before installing RancherOS to disk, i tried to change its IP address, manually:

sudo ip addr add 172.20.74.148/24 dev eth0
sudo route add default gw 172.20.74.254

it was ok, but this does not solve the problem… It just means that the IP 172.20.74.148 works.

Any help would be appreciated ! :cry:

Thanks in advance,

Ernest.

no answer… :disappointed:
i am very disappointed. I repeated the exercise several times, and I always get the same result.

please, help me.

Ernest.

i recorded with RecordMyDesktop the installation of RancherOS on a virtual machine.

you will find it here:
Installing RancherOS on my VMware instrastructure

you will see that the IP address is 172.20.74.237 instead of 172.20.74.148

please, tell me where are the mistakes.

Ernest.

Greetings Ernest. Please verify your .yml file with:

sudo ros config validate -i cloud-config.yml

My guess is that there’s a tab in it.

I’m having a very similar problem. I installed without setting any network configuration, so everything was assigned by DHCP. When I added configuration to the cloud-config.yml file using the following commands, and then rebooted, I was left completely unable to access my RancherOS installation:

$ sudo ros config set rancher.network.dns.nameservers "['192.168.1.210','192.168.1.211']"
$ sudo ros config set rancher.network.dns.search "['mydomain.com']"
$ sudo ros config set rancher.network.interfaces.eth0.address 192.168.1.219/24
$ sudo ros config set rancher.network.interfaces.eth0.gateway 192.168.1.254
$ sudo ros config set rancher.network.interfaces.eth0.dhcp false
$ sudo ros config validate -i /var/lib/rancher/config/cloud-config.yml

I couldn’t SSH into the machine because it had no assigned IP. I couldn’t login directly from the VM’s host machine because the password for user rancher seems to get reset every boot for no apparent reason.

I ran into similar issues, any solution to force the cloud-config to be used?

generally, you should not use a password - set your ssh keys, they’re massively more secure: http://rancher.com/docs/os/configuration/ssh-keys/

I’m very surprised that the cloud-config or settings aren’t working - we use them every day, all the time - and I can’t see anything incorrect :confused:

but - I have noticed that you need to set the cloud-init url datasource in the boot command line - see http://rancher.com/docs/os/running-rancheros/server/pxe/#cloud-init-datasources - which atm is a little painful if you don’t set it in the append line while installing.

Hi there,

I had the same issue with 1.0.4 and this is the way i solved the situation:

  1. Booted with kernel parameter rancher.pasword=rancher
  2. Logged in (user rancher / password rancher)
  3. Did a sudo to root (sudo su -)
  4. Configured all the network stuff as it was indicated above with ros config whatever (see the clauses mentioned above)
  5. Confirmed the configuration was valid with ros config validate -i /var/lib/rancher/conf/cloud-config.yml
  6. Rebooted into the new configuration.

NOTICE: Take the chance to add your own SSH key to the cloud-config.yml file above mentioned to allow you log in using ssh rancher@hostname without a password.

That solved the issue for me. BTW, I’m running a couple of ROS servers on a virtual infrastructure based on VMWare and I did all this initial steps from the VMWare console. In KVM based images I can do that from the virsh console.

Hope this helps.
Best regards

I have to admit, I am having the same issue…

I’ve set up an TFTP server and configured my DHCP with the right filename and TFTP server yet when my host boots up via the network, it downloads and boots into RancherOS’ installer without the cloud-init file.

Here is my iPXE config that gets pulled :

#!ipxe
# Boot a persistent RancherOS to RAM

# Location of Kernel/Initrd images
set base-url http://releases.rancher.com/os/latest

kernel ${base-url}/vmlinuz rancher.state.dev=LABEL=RANCHER_STATE rancher.state.autoformat=[/dev/xvda] -- rancher.cloud_init.datasources=[url:http://192.168.10.104/cloud-config]
initrd ${base-url}/initrd
boot

the url http://192.168.10.104/cloud-config is reachable and I can download the file from my local client so I know it’s hosted and accessible. My cloud config file is as follows :

#cloud-config
hostname: installer
ssh_authorized_keys:
  - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCpmXcktJmAWu8R8eZqXEh4zjMyQAjAGIJ7y4OAPCGShpN7/rHHXugqzGwFZCUqvJH/e2WjAlx/QaqdvsNFRwIvX2yviQAtLHeX7DcjAlFqKJNTm+v3gcr7hT8Sr8f8UOiedH+aHPlua85BgIREgrGMje0pdhgc4WsH7MGbLhID1UDmPVgdNznwXsoErBa1bt3YKqsM0c65rzWR1dROhlIArtGqz0RxMyuwb+LJEMLbif2AgQzlcWe2SJnzHhodAD6SZwH2OnfYAiNTmVs+Nxz/hlqqWjrKzC63u/uSkdp5wHNDi3UQyh3Fq/kQ0/YXmBw5uo0dk1lK0nuyOh6JE9Wn rancher@home.lab

I’ve tried allotting a static IP and network configs but nothing sticks. Even host name in CLI prompt doesn’t change. I cannot SSH into the box with my key despite it being in the cloud init file.

Here is a link to the PXE/HTTPd service being used to bootstrap installation media.

I can’t even pass in rancher.password as kernel parameters during boot. Somehow it’s booting and downloading RancherOS but no kernel parameters are being passed in for some reason. What am I missing?

I’m experiencing a similar well. ‘sudo ros install -c cloud-config.yml -d /dev/sda’ or 'sudo ros install -c /absolute/path/cloud-config.yml -d /dev/sda’
Everything set cloud-config.yml for a bare-metal install is ignored during the install process.

Considering how long this issue is an ongoing in this thread and that it’s unaddressed in the latest release demonstrates a serious lack of commitment by the developers in rancherOS. This lack of support for the community terminates utilizing rancherOS in a production environment even with paid support.

Hello thequietplace,
we had some problems too, with rancheros networking, but we got to a final step, where the right IP address and hostname (as other config parameters) were correctly set to the rancheros machine.

Here you can find our cloud-config.yml template file:

#cloud-config
hostname: rancheros1
rancher:
.console: ubuntu
.network:
…interfaces:
…eth0:
…address: 172.31.110.1/16
…gateway: 172.31.10.1
…mtu: 1500
…dhcp: false
…dns:
…nameservers:
…- 208.67.222.222
…- 8.8.8.8
ssh_authorized_keys:
.- ssh-rsa AAAA …omissis… myemail@gmail.com

Please note: every row starts with a number of character: to make your reading easier, I substituted initial row space with a dot: this is a standard YML format.

have a nice day.

A generic debug step, may be not relevant to all the problems posted here:

If you are specifying a cloud config file while doing a ros install, please make sure to validate it before.

sudo ros config validate -i /tmp/mycloudconfig.yaml

What I found out is that if there is an incorrect setting or keyword or error in the cloud config, the settings are not applied.

Hi,
I have a similar issue. After I added the network configuration via
$ sudo ros config set rancher.network.interfaces.eth0.address

cloud-config.yml is updated. But after reboot cloud-config.yml lost t the new network configurations.

I am running the latest rancherOS on vmware ESXI