|
| 1 | +--- |
| 2 | +sidebar_label: Rancher IP address options |
| 3 | +title: '' |
| 4 | +--- |
| 5 | + |
| 6 | +<head> |
| 7 | + <link rel="canonical" href="https://elemental.docs.rancher.com/rancher-ip"/> |
| 8 | +</head> |
| 9 | + |
| 10 | +import Registration from "!!raw-loader!@site/examples/labeltemplates/registration.yaml" |
| 11 | + |
| 12 | +# Configure K3s and RKE2 internal and external IP addresses |
| 13 | + |
| 14 | +K3s and RKE2 allow to specify the internal and external IP addresses of a node via the |
| 15 | +`--node-ip` and `--node-external-ip` parameters. |
| 16 | + |
| 17 | +Rancher Provisioning allows to fill those parameters collecting the IP address from each node's network |
| 18 | +interface. |
| 19 | + |
| 20 | +Anyway, the methods to collect those ip options for _Custom_ Rancher Clusters and |
| 21 | +_Elemental_ Rancher Clusters differ. |
| 22 | + |
| 23 | +## K3s and RKE2 internal and external IP addresses configuration in Rancher Cluster provisioning |
| 24 | +Rancher provisioning allows to specify in the Rancher Agent section the network interfaces that should |
| 25 | +be bound to the internal and external IP addresses of each provisioned node. |
| 26 | + |
| 27 | +This is performed by adding the network interface names from which the IP addresses should be extracted |
| 28 | +in the `CATTLE_INTERNAL_ADDRESS` and the `CATTLE_ADDRESS` Agent Environment Variables |
| 29 | +([see Rancher docs](https://ranchermanager.docs.rancher.com/reference-guides/cluster-configuration/rancher-server-configuration/use-existing-nodes/rancher-agent-options#ip-address-options)). |
| 30 | + |
| 31 | +:::note |
| 32 | +The `CATTLE_INTERNAL_ADDRESS` and the `CATTLE_ADDRESS` Agent Environment Variables can be directly filled |
| 33 | +with the desired IP addresses. Anyway, since the internal and external IP addresses are *per node*, |
| 34 | +this would not work but for single node clusters. |
| 35 | +::: |
| 36 | + |
| 37 | +:::warning |
| 38 | +While during the creation of an Elemental Cluster it is possible to add Agent Environment Variables, |
| 39 | +the `CATTLE_ADDRESS` and the `CATTLE_INTERNAL_ADDRESS` ones are ignored and would not result in the |
| 40 | +configuration of the internal and external IP addresses of the provisioned nodes. |
| 41 | +::: |
| 42 | + |
| 43 | +## Configure K3s and RKE2 internal and external IP addresses in Elemental Clusters |
| 44 | +Elemental allows to configure the internal and external IP addresses of the Cluster Nodes attaching |
| 45 | +the `elemental.cattle.io/InternalIP` and `elemental.cattle.io/ExternalIP` labels to the |
| 46 | +[MachineInventory](machineinventory-reference.md) resources tracking the target nodes. |
| 47 | + |
| 48 | +These labels when attached to a [MachineInventory](machineinventory-reference.md) resource are used |
| 49 | +to fill the internal and external IP addresses of the associated nodes. |
| 50 | + |
| 51 | +The labels can be added to the [MachineRegistration](machineregistration-reference.md) |
| 52 | +`machineInventoryLabels` fields, using the |
| 53 | +[Network Label Template](label-templates-network.md) IP address variables as values, in order |
| 54 | +to allow to collect the IP addresses of each node. |
| 55 | + |
| 56 | +Example: [MachineRegistration](machineregistration-reference.md) where nodes will have the internal IP |
| 57 | +address set from interface eth0 and the external IP address from eth1. |
| 58 | + |
| 59 | +<CodeBlock language="yaml" title="registration.yaml" showLineNumbers>{Registration}</CodeBlock> |
0 commit comments