Skip to content

Instantly share code, notes, and snippets.

@thebsdbox
Created August 21, 2020 11:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thebsdbox/ccad5b234cdc90d3df1a87d2f0678c73 to your computer and use it in GitHub Desktop.
Save thebsdbox/ccad5b234cdc90d3df1a87d2f0678c73 to your computer and use it in GitHub Desktop.
Tinkerbell with Qemu
# Create Tinkerbell bridge
sudo ip link add tinkerbell type bridge
#
# Assign Address to bridge
sudo ip addr add 192.168.1.1/24 dev tinkerbell
# Create tap
sudo ip tuntap add dev tinkGuest mode tap user $USER
#
# Add to bridge
sudo ip link set tinkGuest master tinkerbell
#
# Bring things up
sudo ip link set tinkGuest up
sudo ip link set tinkerbell up
# Add Nginx address to Tinkerbell
sudo ip addr add 192.168.1.2/24 dev
# Add required dependancies
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
# Add Keys, repositories and install Docker
curl -fsSL https://download.docker.com/linux/ubuntu/gpg |
sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
# Install Docker-Compose
sudo curl -L \
"https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" \
-o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
# Tinkerbell Installation
git clone https://github.com/tinkerbell/tink.git
cd tink
./generate-envrc.sh tinkerbell > envrc
sudo ./setup.sh
# Fix Docker configuration ownership
sudo chown $USER:$USER /home/dan/.docker/config.json
# Do some workflow/hardware stuffs !!
https://tinkerbell.org/examples/hello-world/
# Create a disk
qemu-img create -f qcow2 ftinkGuest.qcow2 4G
# Start a qemu VM that mirrors the vagrant configuration
qemu-system-x86_64 -drive file=tinkGuest.qcow2,aio=threads,format=qcow2 -nic tap,model=virtio-net-pci,mac=08:00:27:00:00:01,ifname=tinkGuest -enable-kvm -cpu host -m 4096 -display none -vnc :7037 -daemonize -qmp unix:/tmp/qmp-000001,server,nowait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment