Skip to content

Commit a9a4b28

Browse files
authored
Update documentation regarding containerlab migration. (#83)
1 parent b1883d7 commit a9a4b28

File tree

3 files changed

+45
-66
lines changed

3 files changed

+45
-66
lines changed

README.md

Lines changed: 44 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,61 @@
11
# mini-lab
22

3-
The mini-lab is a small, virtual setup to locally run the metal-stack. It deploys the metal control plane and a partition with two simulated leaf switches. The lab can be used for trying out metal-stack, demonstration purposes or development.
3+
The mini-lab is a small, virtual setup to locally run the metal-stack. It deploys the metal control plane and a metal-stack partition with two simulated leaf switches. The lab can be used for trying out metal-stack, demonstration purposes or development.
44

55
![overview components](docs/overview.png)
66

7-
This project can also be used as a template for writing your own metal-stack deployments.
7+
This project can also be used as a template for writing your own metal-stack deployments.
88

9-
<!-- TOC depthFrom:2 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 -->
9+
<!-- TOC depthfrom:2 depthto:6 withlinks:true updateonsave:false orderedlist:false -->
1010

11-
- [mini-lab](#mini-lab)
12-
- [Requirements](#requirements)
13-
- [Known Limitations](#known-limitations)
14-
- [Try it out](#try-it-out)
11+
- [Requirements](#requirements)
12+
- [Known Limitations](#known-limitations)
13+
- [Try it out](#try-it-out)
1514
- [Reinstall machine](#reinstall-machine)
16-
- [Remove machine](#remove-machine)
17-
- [Development of metal-api, metal-hammer and metal-core](#development-of-metal-api-metal-hammer-and-metal-core)
15+
- [Free machine](#free-machine)
16+
- [Flavors](#flavors)
1817

1918
<!-- /TOC -->
2019

2120
## Requirements
2221

2322
- Linux machine with hardware virtualization support
24-
- [Vagrant](https://www.vagrantup.com/) == 2.2.14 with vagrant-libvirt plugin >= 0.3.0 (for running the switch and machine VMs)
25-
- kvm as hypervisor for the VMs
26-
- Ubuntu 20.04:
27-
28-
sudo apt update
29-
sudo apt install -y qemu qemu-kvm libvirt-daemon bridge-utils virtinst libvirt-dev git curl build-essential wget
30-
23+
- kvm as hypervisor for the VMs (you can check through the `kvm-ok` command)
3124
- [docker](https://www.docker.com/) >= 18.09 (for using kind and our deployment base image)
3225
- [docker-compose](https://docs.docker.com/compose/) >= 1.25.4 (for ease of use and for parallelizing control plane and partition deployment)
3326
- [kind](https://github.com/kubernetes-sigs/kind/releases) == v0.9.0 (for hosting the metal control plane on a kubernetes cluster v1.19.1)
34-
- [ovmf](https://wiki.ubuntu.com/UEFI/OVMF) to have a uefi firmware for virtual machines
35-
- the lab creates a virtual network 192.168.121.0/24 on your host machine, this hopefully does not overlap with other networks you have
27+
- [containerlab](https://containerlab.srlinux.dev/install/)
28+
- the lab creates a docker network on your host machine (`172.17.0.1`), this hopefully does not overlap with other networks you have
3629
- (recommended) haveged to have enough random entropy (only needed if the PXE process does not work)
3730

3831
Here is some code that should help you setting up most of the requirements:
3932

4033
```bash
34+
# Install kvm
35+
sudo apt install -y git curl qemu qemu-kvm havaged
36+
4137
# Install Docker
4238
curl -fsSL https://get.docker.com | sh
4339
# if you want to be on the safe side, follow the original installation
4440
# instructions at https://docs.docker.com/engine/install/ubuntu/
4541

46-
# Install vagrant and other stuff
47-
wget https://releases.hashicorp.com/vagrant/2.2.14/vagrant_2.2.14_x86_64.deb
48-
sudo apt-get install ./vagrant_2.2.14_x86_64.deb qemu-kvm virt-manager ovmf net-tools libvirt-dev haveged
49-
50-
# Ensure that your user is member of the group "libvirt" and "docker"
42+
# Ensure that your user is member of the group "docker"
5143
# you need to login again in order to make this change take effect
52-
sudo usermod -G libvirt,docker -a ${USER}
44+
sudo usermod -G docker -a ${USER}
5345

54-
# Install libvirt plugin for vagrant
55-
vagrant plugin install vagrant-libvirt
46+
# Install containerlab
47+
bash -c "$(curl -sL https://get-clab.srlinux.dev)"
5648

5749
# Install kind (kubernetes in docker), for more details see https://kind.sigs.k8s.io/docs/user/quick-start/#installation
58-
curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64
59-
chmod +x ./kind
60-
sudo mv ./kind /usr/local/bin/kind
50+
sudo curl -Lo /usr/local/bin/kind "https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64"
51+
sudo chmod +x /usr/local/bin/kind
6152

6253
# Install docker-compose, for more details see https://docs.docker.com/compose/install/
63-
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
54+
sudo curl -Lo /usr/local/bin/docker-compose "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)"
6455
sudo chmod +x /usr/local/bin/docker-compose
6556
```
6657

67-
The following ports are getting used statically:
58+
The following ports are used statically on your host machine:
6859

6960
| Port | Bind Address | Description |
7061
|:----:|:------------ |:---------------------------------- |
@@ -82,15 +73,19 @@ The following ports are getting used statically:
8273

8374
## Try it out
8475

85-
Start the mini-lab with a kind cluster, a metal-api instance as well as some vagrant VMs with two leaf switches and two machine skeletons.
86-
8776
```bash
8877
git clone https://github.com/metal-stack/mini-lab.git
8978
cd mini-lab
79+
```
80+
81+
Start the mini-lab with a kind cluster, a metal-api instance as well as two containers wrapping leaf switches and another container that hosts two user-allocatable machines:
82+
83+
```bash
9084
make
85+
# containerlab will ask you for root permissions (https://github.com/srl-labs/containerlab/issues/669)
9186
```
9287

93-
Two machines in status `PXE booting` are visible with `metalctl machine ls`
88+
After the deployment and waiting for a short amoung of time, two machines in status `PXE booting` become visible through `metalctl machine ls`:
9489

9590
```bash
9691
docker-compose run metalctl machine ls
@@ -100,7 +95,7 @@ e0ab02d2-27cd-5a5e-8efc-080ba80cf258   PXE Booting 3s
10095
2294c949-88f6-5390-8154-fa53d93a3313 PXE Booting 5s
10196
```
10297

103-
Wait until the machines reach the waiting state
98+
Wait until the machines reach the waiting state:
10499

105100
```bash
106101
docker-compose run metalctl machine ls
@@ -110,42 +105,42 @@ e0ab02d2-27cd-5a5e-8efc-080ba80cf258   Waiting 8s
110105
2294c949-88f6-5390-8154-fa53d93a3313   Waiting 8s v1-small-x86 vagrant
111106
```
112107

113-
Create a machine/firewall with
108+
Create a firewall and a machine with:
114109

115110
```bash
116111
make firewall
117112
make machine
118113
```
119114

120-
__Alternatively__ you may want to issue the `metalctl` commands by your own:
115+
__Alternatively__, you may want to issue the `metalctl` commands on your own:
121116

122117
```bash
123118
docker-compose run metalctl network allocate \
124-
--partition vagrant \
119+
--partition mini-lab \
125120
--project 00000000-0000-0000-0000-000000000000 \
126-
--name vagrant
121+
--name user-private-network
127122

128-
# Lookup the network ID and create a machine
123+
# lookup the network ID and create a machine
129124
docker-compose run metalctl machine create \
130125
--description test \
131126
--name machine \
132127
--hostname machine \
133128
--project 00000000-0000-0000-0000-000000000000 \
134-
--partition vagrant \
129+
--partition mini-lab \
135130
--image ubuntu-20.04 \
136131
--size v1-small-x86 \
137132
--networks <network-ID>
138133

139-
# Create a firewall that is also connected to the virtual internet-vagrant-lab network
134+
# create a firewall that is also connected to the virtual internet-mini-lab network
140135
docker-compose run metalctl machine create \
141136
--description fw \
142137
--name fw \
143138
--hostname fw \
144139
--project 00000000-0000-0000-0000-000000000000 \
145-
--partition vagrant \
140+
--partition mini-lab \
146141
--image firewall-ubuntu-2.0 \
147142
--size v1-small-x86 \
148-
--networks internet-vagrant-lab,$(privatenet)
143+
--networks internet-mini-lab,$(privatenet)
149144
```
150145

151146
See the installation process in action
@@ -170,12 +165,10 @@ e0ab02d2-27cd-5a5e-8efc-080ba80cf258   Phoned Home 2s 21s machin
170165
Login with user name metal and the console password from
171166

172167
```bash
173-
docker-compose run metalctl machine describe e0ab02d2-27cd-5a5e-8efc-080ba80cf258 | grep password
174-
175-
consolepassword: ...
168+
docker-compose run metalctl machine consolepassword e0ab02d2-27cd-5a5e-8efc-080ba80cf258
176169
```
177170

178-
If you want to access the firewall with SSH or have internet connectivity from the firewall and machine, you'll need to have a static route configured that points to the vagrant boxes of the leaf switches:
171+
If you want to access the firewall with SSH or have internet connectivity from the firewall and machine, you'll need to have a static route configured that points to the leaf switches:
179172

180173
```bash
181174
# Add the route to the network internet-vagrant-lab 100.255.254.0/24 via leaf01 and leaf02, whose IPs are dynamically allocated. Make sure there's no old route before execution.
@@ -185,7 +178,7 @@ make route
185178
ssh metal@100.255.254.1
186179
```
187180

188-
To remove the kind cluster and the vagrant boxes, run
181+
To remove the kind cluster, the switches and machines, run:
189182

190183
```bash
191184
make cleanup
@@ -201,9 +194,9 @@ docker-compose run metalctl machine reinstall \
201194
e0ab02d2-27cd-5a5e-8efc-080ba80cf258
202195
```
203196

204-
### Remove machine
197+
### Free machine
205198

206-
Remove a machine with
199+
Free a machine with
207200

208201
```bash
209202
docker-compose run metalctl machine rm e0ab02d2-27cd-5a5e-8efc-080ba80cf258
@@ -222,17 +215,3 @@ In order to start specific flavor, you can define the flavor as follows:
222215
export MINI_LAB_FLAVOR=cluster-api
223216
make
224217
```
225-
226-
## Development of metal-api, metal-hammer and metal-core
227-
228-
To simplify developing changes for the `metal-api`, `metal-hammer` and `metal-core`, it is possible to use development artifacts from within the mini-lab.
229-
See the [dev instructions](DEV_INSTRUCTIONS.md) for more details.
230-
231-
FROM ubuntu:20.04
232-
233-
RUN apt update -y && \
234-
DEBIAN_FRONTEND=noninteractive apt install -y virt-manager ovmf net-tools haveged \
235-
qemu qemu-kvm bridge-utils virtinst libvirt-dev libvirt-daemon-system build-essential libvirt-clients
236-
237-
CMD ["/usr/sbin/init"]
238-

docs/overview.drawio

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/overview.png

28.9 KB
Loading

0 commit comments

Comments
 (0)