Skip to content

Commit 16342fb

Browse files
authored
HowTo: cover Rancher Provisioning IP options (#447)
* HowTo: sort topics lexicographically Signed-off-by: Francesco Giudici <[email protected]> * HOWTO: cover Rancher Provisioning IP options Share the Elemental way to configure the Internal and the External IP addresses in K3s and RKE2 Signed-off-by: Francesco Giudici <[email protected]> --------- Signed-off-by: Francesco Giudici <[email protected]>
1 parent 191aef1 commit 16342fb

File tree

3 files changed

+87
-7
lines changed

3 files changed

+87
-7
lines changed

docs/rancher-ip.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: elemental.cattle.io/v1beta1
2+
kind: MachineRegistration
3+
metadata:
4+
name: fire-nodes
5+
namespace: fleet-default
6+
spec:
7+
config:
8+
cloud-config:
9+
users:
10+
- name: root
11+
passwd: root
12+
elemental:
13+
install:
14+
reboot: true
15+
device: /dev/sda
16+
debug: true
17+
machineInventoryLabels:
18+
element: fire
19+
elemental.cattle.io/InternalIP: ${Network/NICs/eth0/IPv4Address}
20+
elemental.cattle.io/ExternalIP: ${Network/NICs/eth1/IPv4Address}

sidebars.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,11 @@ const sidebars = {
140140
"collapsed": true,
141141
"label": "How to",
142142
"items": [
143+
"custom-certificate",
144+
"airgap",
143145
"custom-images",
146+
"raspi-disk",
147+
"ntp",
144148
{
145149
"type": "category",
146150
"collapsible": true,
@@ -152,16 +156,13 @@ const sidebars = {
152156
"lvm-drives-example"
153157
]
154158
},
155-
"elemental_behind_proxy",
156159
"hostname",
157-
"ntp",
160+
"elemental_behind_proxy",
158161
"rancher-vmware",
159162
"removable-device-cloudconfig",
160-
"custom-certificate",
161-
"airgap",
162-
"raspi-disk",
163-
"tpm",
164-
"unmanaged-os"
163+
"rancher-ip",
164+
"unmanaged-os",
165+
"tpm"
165166
]
166167
},
167168
{

0 commit comments

Comments
 (0)