Skip to content

Latest commit

 

History

History
89 lines (65 loc) · 2.43 KB

Multipass-SSH-Configuration.md

File metadata and controls

89 lines (65 loc) · 2.43 KB

LAB: Multipass-SSH-Configuration (Create Ansible Test Environment)

This scenario shows:

  • how to install multipass
  • how to create control node, managed nodes
  • how to configure ssh between control node and managed nodes

Steps

  • "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

image

  • 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

image

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)

image

  • 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)

image

  • List all VMs to get IPs
multipass list

image

  • SSH from controlplane to node1
ssh <IP>
or 
ssh <username>@<IP>

image

References