Update Harvester Configuration After Installation

Harvester’s OS has an immutable design, which means most files in the OS revert to their pre-configured state after a reboot. The Harvester OS loads the pre-configured values of system components from configuration files during the boot time.

This page describes how to edit some of the most-requested Harvester configurations. To update a configuration, you must first update the runtime value in the system and then update configuration files to make the changes persistent between reboots.

Update Harvester Configuration - 图1note

If you upgrade from a version before v1.1.2, the cloud-init file in examples will be /oem/99_custom.yaml. Please substitute the value if needed.

DNS servers

Runtime change

  1. Log in to a Harvester node and become root. See how to log into a Harvester node for more details.

  2. Edit /etc/sysconfig/network/config and update the following line. Use a space to separate DNS server addresses if there are multiple servers.

    1. NETCONFIG_DNS_STATIC_SERVERS="8.8.8.8 1.1.1.1"
  3. Update and reload the configuration with the following command:

    1. netconfig update
  4. Confirm the file /etc/resolv.conf contains the correct DNS servers with the cat command:

    1. cat /etc/resolv.conf

Configuration persistence

  1. Backup the elemental cloud-init file /oem/90_custom.yaml as follows:

    1. cp /oem/90_custom.yaml /oem/install/90_custom.yaml.$(date --iso-8601=minutes)
  2. Edit /oem/90_custom.yaml and update the value under the yaml path stages.initramfs[0].commands. The commands array must contain a line to manipulate the NETCONFIG_DNS_STATIC_SERVERS config. Add the line if the line doesn’t exist.

    The following example adds a line to change the NETCONFIG_DNS_STATIC_SERVERS config:

    1. stages:
    2. initramfs:
    3. - commands:
    4. - sed -i 's/^NETCONFIG_DNS_STATIC_SERVERS.*/NETCONFIG_DNS_STATIC_SERVERS="8.8.8.8 1.1.1.1"/' /etc/sysconfig/network/config

    Replace the DNS server addresses and save the file. Harvester sets up new servers after rebooting.

NTP servers

Runtime change

  1. Log in to a Harvester node and become root. See how to log into a Harvester node for more details.

  2. Edit /etc/systemd/timesyncd.conf and specify NTP servers in the NTP= setting:

    1. [Time]
    2. NTP = 0.suse.pool.ntp.org 1.suse.pool.ntp.org
  3. Restart the systemd-timesyncd.service service:

    1. systemctl restart systemd-timesyncd.service
  4. Display the timesync status:

    1. timedatectl timesync-status

Configuration persistence

  1. Backup the elemental cloud-init file /oem/90_custom.yaml as follows:

    1. cp /oem/90_custom.yaml /oem/install/90_custom.yaml.$(date --iso-8601=minutes)
  2. Edit /oem/90_custom.yaml and update the yaml path stages.initramfs[0].timesyncd. The timesyncd map must be in the following format:

    1. stages:
    2. initramfs:
    3. - ...
    4. timesyncd:
    5. NTP: 0.suse.pool.ntp.org 1.suse.pool.ntp.org
  3. Edit /oem/90_custom.yaml and update the yaml path stages.initramfs[0].systemctl.enable. The array must have the two services (systemd-timesyncd and systemd-time-wait-sync) enabled:

    1. stages:
    2. initramfs:
    3. - ...
    4. systemctl:
    5. enable:
    6. systemd-timesyncd
    7. systemd-time-wait-sync
    8. disable: []
    9. start: []
    10. mask: []

SSH keys of user rancher

Runtime change

  1. Log in to a Harvester node as user rancher. See how to log into a Harvester node for more details.
  2. Edit /home/rancher/.ssh/authorized_keys to add or remove keys.

Configuration persistence

  1. Backup the elemental cloud-init file /oem/90_custom.yaml as follows:

    1. cp /oem/90_custom.yaml /oem/install/90_custom.yaml.$(date --iso-8601=minutes)
  2. Edit /oem/90_custom.yaml and update the yaml path stages.network[0].authorized_keys.rancher. Add or remove keys in the rancher array:

    1. stages:
    2. network:
    3. - ...
    4. authorized_keys:
    5. rancher:
    6. - key1
    7. - key2

Password of user rancher

Runtime change

  1. Log in to a Harvester node as user rancher. See how to log into a Harvester node for more details.
  2. To reset the password for the user rancher, run the command passwd.

Configuration persistence

  1. Backup the elemental cloud-init file /oem/90_custom.yaml as follows:

    1. cp /oem/90_custom.yaml /oem/install/90_custom.yaml.$(date --iso-8601=minutes)
  2. Edit /oem/90_custom.yaml and update the yaml path stages.initramfs[0].users.rancher.passwd. Refer to the configuration os.password for details on how to specify the password in an encrypted form.

Bonding slaves

You can update the slave interfaces of Harvester’s management bonding interface mgmt-bo.

Runtime change

  1. Log in to a Harvester node and become root. See how to log into a Harvester node for more details.

  2. Identify the interface names with the following command:

    1. ip a
  3. Edit /etc/sysconfig/network/ifcfg-mgmt-bo and update the lines associated with bonding slaves and bonding mode:

    1. BONDING_SLAVE_0='ens5'
    2. BONDING_SLAVE_1='ens6'
    3. BONDING_MODULE_OPTS='miimon=100 mode=balance-tlb '
  4. Restart the network with the wicked ifreload command:

    1. wicked ifreload mgmt-bo

    Update Harvester Configuration - 图2caution

    A mistake in the configuration may disrupt the SSH session.

Configuration persistence

  1. Backup the elemental cloud-init file /oem/90_custom.yaml as follows:

    1. cp /oem/90_custom.yaml /oem/install/90_custom.yaml.$(date --iso-8601=minutes)
  2. Edit /oem/90_custom.yaml and update the yaml path stages.initramfs[0].files. More specifically, update the content of the /etc/sysconfig/network/ifcfg-mgmt-bo file and edit the BONDING_SLAVE_X and BONDING_MODULE_OPTS entries accordingly:

    ``` stages: initramfs:

    • … files:
      • path: /etc/sysconfig/network/ifcfg-mgmt-bo permissions: 384 owner: 0 group: 0 content: |+
        1. STARTMODE='onboot'
        2. BONDING_MASTER='yes'
        3. BOOTPROTO='none'
        4. POST_UP_SCRIPT="wicked:setup_bond.sh"
  1. BONDING_SLAVE_0='ens5'
  2. BONDING_SLAVE_1='ens6'
  3. BONDING_MODULE_OPTS='miimon=100 mode=balance-tlb '
  4. DHCLIENT_SET_DEFAULT_ROUTE='no'
  5. encoding: ""
  6. ownerstring: ""
  7. - path: /etc/sysconfig/network/ifcfg-ens6
  8. permissions: 384
  9. owner: 0
  10. group: 0
  11. content: |
  12. STARTMODE='hotplug'
  13. BOOTPROTO='none'
  14. encoding: ""
  15. ownerstring: ""
  16. ```
  17. ![](/projects/harvester-1.2-en/adadd309cd63e4cc81476cb1404c35c9.svg)note
  18. If you didn't select an interface during installation, you must add an entry to initialize the interface. Please check the `/etc/sysconfig/network/ifcfg-ens6` file creation in the above example. The file name should be `/etc/sysconfig/network/ifcfg-<interface-name>`.