22
33<!-- cSpell:ignore htpasswd,virsh -->
44
5- This guide has been tested on Ubuntu server 22 .04. It should be seen as an
5+ This guide has been tested on Ubuntu server 24 .04. It should be seen as an
66example rather than the absolute truth about how to deploy and use Metal3. We
77will cover two environments and two scenarios. The environments are
88
@@ -79,70 +79,29 @@ and the MAC address:
7979Start by defining a libvirt network:
8080
8181``` xml
82- <network >
83- <name >baremetal</name >
84- <forward mode =' nat' >
85- <nat >
86- <port start =' 1024' end =' 65535' />
87- </nat >
88- </forward >
89- <bridge name =' metal3' />
90- <ip address =' 192.168.222.1' netmask =' 255.255.255.0' >
91- </ip >
92- </network >
82+ {{#embed-github repo:"metal3-io/metal3-docs" branch:"main" path:"docs/user-guide/examples/net.xml"}}
9383```
9484
95- Save this as ` net.xml ` , define it and start it.
96-
97- ``` bash
98- virsh -c qemu:///system net-define net.xml
99- virsh -c qemu:///system net-start baremetal
100- ```
101-
102- Next, we will create a virtual machine. Feel free to adjust at as you see fit,
103- but make sure to note the MAC address. That will be needed later. You can also
104- create more than one if you like.
105-
106- ``` bash
107- # use --ram=8192 for Scenario 2
108- virt-install \
109- --connect qemu:///system \
110- --name bmh-vm-01 \
111- --description " Virtualized BareMetalHost" \
112- --osinfo=ubuntu-lts-latest \
113- --ram=4096 \
114- --vcpus=2 \
115- --disk size=25 \
116- --graphics=none \
117- --console pty \
118- --serial pty \
119- --pxe \
120- --network network=baremetal,mac=" 00:60:2f:31:81:01" \
121- --noautoconsole
122- ```
123-
124- ### Sushy-tools - AKA the BMC
85+ Save this as ` net.xml ` .
12586
12687Metal3 relies on baseboard management controllers to manage the baremetal
12788servers, so we need something similar for our virtual machines. This comes in
12889the form of [ sushy-tools] ( https://docs.openstack.org/sushy/latest/ ) .
12990
130- We need to create configuration file first :
91+ We need to create a configuration file for sushy-tools :
13192
13293``` conf
133- # Listen on 192.168.222.1:8000
134- SUSHY_EMULATOR_LISTEN_IP = u'192.168.222.1'
135- SUSHY_EMULATOR_LISTEN_PORT = 8000
136- # The libvirt URI to use. This option enables libvirt driver.
137- SUSHY_EMULATOR_LIBVIRT_URI = u'qemu:///system'
94+ {{#embed-github repo:"metal3-io/metal3-docs" branch:"main" path:"docs/user-guide/examples/sushy-emulator.conf"}}
13895```
13996
97+ Finally, we start up the virtual baremetal lab and create VMs to simulate the
98+ servers. Feel free to adjust things as you see fit, but make sure to note the
99+ MAC address. That will be needed later. You can choose how many VMs to create.
100+ One is needed for scenario 1, two or more for scenario 2.
101+
140102``` bash
141- docker run --name sushy-tools --rm --network host -d \
142- -v /var/run/libvirt:/var/run/libvirt \
143- -v " $( pwd) /sushy-tools.conf:/etc/sushy/sushy-emulator.conf" \
144- -e SUSHY_EMULATOR_CONFIG=/etc/sushy/sushy-emulator.conf \
145- quay.io/metal3-io/sushy-tools:latest sushy-emulator
103+ # use --ram=8192 for Scenario 2
104+ {{# embed-github repo:"Nordix/metal3-docs" branch:"lentzi90/quick-revision" path:"docs/user-guide/examples/setup-virtual-lab.sh"}}
146105```
147106
148107## Common setup
@@ -164,22 +123,7 @@ note that this is absolutely not intended for production environments.
164123We will use the following configuration file for kind, save it as ` kind.yaml ` :
165124
166125``` yaml
167- kind : Cluster
168- apiVersion : kind.x-k8s.io/v1alpha4
169- nodes :
170- - role : control-plane
171- # Open ports for Ironic
172- extraPortMappings :
173- # Ironic httpd
174- - containerPort : 6180
175- hostPort : 6180
176- listenAddress : " 0.0.0.0"
177- protocol : TCP
178- # Ironic API
179- - containerPort : 6385
180- hostPort : 6385
181- listenAddress : " 0.0.0.0"
182- protocol : TCP
126+ {{#embed-github repo:"metal3-io/metal3-docs" branch:"main" path:"docs/user-guide/examples/kind.yaml"}}
183127```
184128
185129As you can see, it has a few ports forwarded from the host. This is to make
@@ -195,22 +139,23 @@ We will need to install cert-manager also. It will be used to manage the
195139certificates for Ironic later.
196140
197141``` bash
198- kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.14.3 /cert-manager.yaml
142+ kubectl apply -f https://github.com/cert-manager/cert-manager/releases/latest/download /cert-manager.yaml
199143```
200144
201145### DHCP server
202146
203147The BareMetalHosts must be able to call back to Ironic when going through the
204148inspection phase. This means that they must have IP addresses in a network where
205- they can reach Ironic. We will set up a DHCP server for this purpose.
206-
207- Any DHCP server can be used for this. We will here use the Ironic container
208- image that incudes dnsmasq and some scripts for configuring it.
149+ they can reach Ironic. Any DHCP server can be used for this.
209150
210- Create a configuration file and save it as ` dnsmasq.env ` .
151+ For the virtualized environment, we rely on the libvirt network to provide the DHCP server .
211152
212153Baremetal lab:
213154
155+ We will here use the Ironic container
156+ image that incudes dnsmasq and some scripts for configuring it.
157+ Create a configuration file and save it as ` dnsmasq.env ` .
158+
214159``` bash
215160# The same HTTP port must be provided to all containers!
216161HTTP_PORT=6180
@@ -225,26 +170,6 @@ DHCP_RANGE=192.168.0.100,192.168.0.149
225170GATEWAY_IP=192.168.0.1
226171```
227172
228- Virtualized environment:
229-
230- ``` bash
231- HTTP_PORT=6180
232- DHCP_HOSTS=00:60:2f:31:81:01
233- DHCP_IGNORE=tag:! known
234- # IP of the host from VM perspective
235- PROVISIONING_IP=192.168.222.1
236- GATEWAY_IP=192.168.222.1
237- DHCP_RANGE=192.168.222.100,192.168.222.149
238- ```
239-
240- You can now run the DHCP server like this:
241-
242- ``` bash
243- docker run --name dnsmasq --rm -d --net=host --privileged --user 997:994 \
244- --env-file dnsmasq.env --entrypoint /bin/rundnsmasq \
245- quay.io/metal3-io/ironic
246- ```
247-
248173### Image server
249174
250175In order to do anything useful, we will need a server for hosting disk images
@@ -336,7 +261,7 @@ PROVISIONING_INTERFACE=eth0
336261CACHEURL=http://192.168.222.1/images
337262IRONIC_KERNEL_PARAMS=console=ttyS0
338263# Docker does not allow cross-network access. If using kind to create the management
339- # cluster, explicitly set the external ip and use port forwarding to access ironic services.
264+ # cluster, explicitly set the external ip and use port forwarding to access ironic services.
340265IRONIC_EXTERNAL_IP=192.168.222.1
341266```
342267
@@ -578,7 +503,7 @@ place.
5785031. Deploy cert-manager.
579504
580505 ` ` ` bash
581- kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.14.3 /cert-manager.yaml
506+ kubectl apply -f https://github.com/cert-manager/cert-manager/releases/latest/download /cert-manager.yaml
582507 ` ` `
583508
5845091. Start the DHCP server.
0 commit comments