Skip to content

Commit 5c130e5

Browse files
committed
WIP
Signed-off-by: Lennart Jern <[email protected]>
1 parent 39e09f9 commit 5c130e5

File tree

4 files changed

+89
-97
lines changed

4 files changed

+89
-97
lines changed

docs/user-guide/examples/kind.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: kind.x-k8s.io/v1alpha4
2+
kind: Cluster
3+
nodes:
4+
- role: control-plane
5+
# Open ports for Ironic
6+
extraPortMappings:
7+
# Ironic httpd
8+
- containerPort: 6180
9+
hostPort: 6180
10+
listenAddress: "0.0.0.0"
11+
protocol: TCP
12+
# Ironic API
13+
- containerPort: 6385
14+
hostPort: 6385
15+
listenAddress: "0.0.0.0"
16+
protocol: TCP

docs/user-guide/examples/net.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<network>
2+
<name>baremetal-e2e</name>
3+
<forward mode='nat'>
4+
<nat>
5+
<port start='1024' end='65535'/>
6+
</nat>
7+
</forward>
8+
<bridge name='metal3'/>
9+
<ip address='192.168.222.1' netmask='255.255.255.0'>
10+
<dhcp>
11+
<range start='192.168.222.3' end='192.168.222.99'/>
12+
<bootp file='http://192.168.222.2:6180/boot.ipxe'/>
13+
</dhcp>
14+
</ip>
15+
</network>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Listen on the local IP address 192.168.222.1
2+
SUSHY_EMULATOR_LISTEN_IP = u'192.168.222.1'
3+
4+
# Bind to TCP port 8000
5+
SUSHY_EMULATOR_LISTEN_PORT = 8000
6+
7+
# Serve this SSL certificate to the clients
8+
SUSHY_EMULATOR_SSL_CERT = None
9+
10+
# If SSL certificate is being served, this is its RSA private key
11+
SUSHY_EMULATOR_SSL_KEY = None
12+
13+
# The OpenStack cloud ID to use. This option enables OpenStack driver.
14+
SUSHY_EMULATOR_OS_CLOUD = None
15+
# The libvirt URI to use. This option enables libvirt driver.
16+
SUSHY_EMULATOR_LIBVIRT_URI = u'qemu:///system'
17+
18+
# Instruct the libvirt driver to ignore any instructions to
19+
# set the boot device. Allowing the UEFI firmware to instead
20+
# rely on the EFI Boot Manager
21+
# Note: This sets the legacy boot element to dev="fd"
22+
# and relies on the floppy not existing, it likely wont work
23+
# your VM has a floppy drive.
24+
SUSHY_EMULATOR_IGNORE_BOOT_DEVICE = False
25+
26+
# The map of firmware loaders dependant on the boot mode and
27+
# system architecture. Ideally the x86_64 loader will be capable
28+
# of secure boot or not based on the chosen nvram.
29+
SUSHY_EMULATOR_BOOT_LOADER_MAP = {
30+
u'UEFI': {
31+
u'x86_64': u'/usr/share/OVMF/OVMF_CODE.secboot.fd'
32+
},
33+
u'Legacy': {
34+
u'x86_64': None
35+
}
36+
}

docs/user-guide/src/quick-start.md

Lines changed: 22 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
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
66
example rather than the absolute truth about how to deploy and use Metal3. We
77
will cover two environments and two scenarios. The environments are
88

@@ -79,70 +79,29 @@ and the MAC address:
7979
Start 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

12687
Metal3 relies on baseboard management controllers to manage the baremetal
12788
servers, so we need something similar for our virtual machines. This comes in
12889
the 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.
164123
We 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

185129
As 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
195139
certificates 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

203147
The BareMetalHosts must be able to call back to Ironic when going through the
204148
inspection 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

212153
Baremetal 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!
216161
HTTP_PORT=6180
@@ -225,26 +170,6 @@ DHCP_RANGE=192.168.0.100,192.168.0.149
225170
GATEWAY_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

250175
In order to do anything useful, we will need a server for hosting disk images
@@ -336,7 +261,7 @@ PROVISIONING_INTERFACE=eth0
336261
CACHEURL=http://192.168.222.1/images
337262
IRONIC_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.
340265
IRONIC_EXTERNAL_IP=192.168.222.1
341266
```
342267

@@ -578,7 +503,7 @@ place.
578503
1. 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

584509
1. Start the DHCP server.

0 commit comments

Comments
 (0)