This scenario shows:
- how to install multipass
- how to create control node, managed nodes
- how to configure ssh between control node and managed nodes
- "Multipass is a mini-cloud on your workstation using native hypervisors of all the supported plaforms (Windows, macOS and Linux)"
- Fast to install and to use.
- Link: https://multipass.run/
- Install on Linux, Windows and MacOs: https://multipass.run/install
- After installing, we can create VMs on our local machine.
# creating controlnode, managed nodes (node1, node2, etc.)
# -c => cpu, -m => memory, -d => disk space
multipass launch --name controlnode -c 2 -m 2G -d 10G
multipass launch --name node1 -c 2 -m 2G -d 10G
multipass launch --name node2 -c 2 -m 2G -d 10G
multipass list
- Connect VMs by opening shells
# get shell on controlnode
multipass shell controlnode
# get shell on node1, on different terminal
multipass shell node1
# get shell on node2, on different terminal
multipass shell node2
sudo apt update
sudo apt install net-tools
# to see IPs
ifconfig
- Create ssh public key on control plane
- Copy the public key from control plane
> on controlnode
ssh-keygen (no password, enter 3 times)
cat ~/.ssh/id_rsa.pub (copy the value)
- Paste copied public key (control plane) into the authorized_keys in each managed nodes.
cd .ssh (on each workers)
nano authorized_keys
> Paste keys from controlnode (hence managed nodes know the controlnode IP and public key, controlnode can connect it)
- List all VMs to get IPs
multipass list
- SSH from controlplane to node1
ssh <IP>
or
ssh <username>@<IP>