Setting the node roles in the hosts file
The hosts file contains the IP address of the master, worker, proxy, and optional management and Vulnerability Advisor nodes in your cluster.
For more information about IBM® Cloud Private node types, see Architecture.
This hosts file is in the /<installation_directory>/cluster folder.
During IBM Cloud Private installation, you add the IP address for your master, worker, and proxy nodes to this file. You can optionally specify a management node. After you install IBM Cloud Private, you cannot modify the master, proxy, or management nodes in your cluster.
Important: Do not add host names to this file.
- Open the
/<installation_directory>/cluster/hostsfile. -
Add the IP addresses for the different node types to the different sections of the file.
- For a standard or Community Edition environment, you can have only one node in the master section.
- For a high availability (HA) environment, specify multiple hosts in the master and proxy sections. You can specify any number of proxy nodes but must specify 3 or 5 master nodes. You can configure high availability for only the master nodes, only the proxy nodes, or for both types of node. See Understanding high availability and proxy nodes for more information.
- You can enable the optional management node.
- If you use a single computer as multiple nodes in your cluster, you must specify its IP address in each applicable node section. For example, if you use the same node as a master and proxy, enter its IP address in both the
masterandproxysections. - You can enable the optional etcd node. If you add an etcd node,
etcdis installed on this node. Else,etcdis installed on the master node.
The
hostsfile for a standard or Community Edition environment resembles the following text:[master] <master_node_IP_address> [worker] <worker_node_1_IP_address> .... <worker_node_n_IP_address> [proxy] <proxy_node_IP_address> [management] <management_node_1_IP_address> .... <management_node_n_IP_address> [va] <va_node_IP_address> [etcd] <etcd_node_IP_address>
Note: If you want to enable management nodes, you must remove the # from the [management] header.
The hosts file for a high availability environment resembles the following text:
[master]
<master_node_1_IP_address>
<master_node_2_IP_address>
<master_node_3_IP_address>
[worker]
<worker_node_1_IP_address>
....
<worker_node_n_IP_address>
[proxy]
<proxy_node_1_IP_address>
<proxy_node_2_IP_address>
<proxy_node_3_IP_address>
[management]
<management_node_1_IP_address>
....
<management_node_n_IP_address>
[va]
<va_node_IP_address>
[etcd]
<etcd_node_IP_address>
Note: If you want to enable Vulnerability Advisor and management nodes, you must remove the # from the [va] and [management] headers.
-
In HA environments, you can also set values for node-specific parameters in the hosts file. For example, you can set the
vip_ifaceparameter values, as show in the following code:[master] <master_node_1_IP_address> vip_iface=eth0 <master_node_2_IP_address> vip_iface=ens192 <master_node_3_IP_address> vip_iface=ens160Parameter values in the
config.yamlfile have the higher priority during an installation. To set a parameter value in the hosts file, you must remove the parameter from theconfig.yamlfile. See Installing IBM® Cloud Private Cloud Native, Enterprise, and Community editions.
Defining custom host groups
You can also create host groups that can be reserved for specific applications or processes. Host groups can be defined during installation or post installation.
To define a custom host group:
-
Create a name for the host group. The host group name must be in the format
hostgroup-customname. -
Add the IPs for the host that belong to the custom host group. For example, to create a custom host group that can be used by Db2 processes only. Add the following to the
hostsfile....... [hostgroup-db2] <hostgroup_node_1_IP_address> <hostgroup_node_2_IP_address> <hostgroup_node_3_IP_address> -
Deploy the host group.
- If you are creating a custom host group during installation, continue with the installation procedure.
- If you are creating a custom host group post installation, see Adding cluster nodes.
After deployment, host group nodes are assigned the customname=true label and dedicated=customname:NoSchedule taints. For example, the hostgroup-db2 nodes are assigned the db2=true label and dedicated=db2:NoSchedule taints.