This is a guide to supliment the https://learn.hashicorp.com/consul/ content
To access the vm's you will need the IP address and a copy of the private key your instructure created
cd /tmp
mkdir keys
cd /tmp/keys
vi lab_rsa
press i
copy past the public key text shared with you
press esc key
:wq! enter
chmod 400 lab_rsa
*This step assumes you are still in the dir /tmp/keys created in the previous step
ssh -i ./lab_rsa ubuntu@<yourVMipAddr>
Repeat as need for multiple sessions, or to connect to other lab vm's
This should be performed on all of your lab vm's
ssh -i ./lab_rsa ubuntu@<yourVMpublicIpAddr>
cd /tmp
wget https://releases.hashicorp.com/consul/1.4.4/consul_1.4.4_linux_amd64.zip
sudo apt install unzip -y
unzip consul_1.4.4_linux_amd64.zip
sudo chmod +x consul
sudo mv consul /usr/bin/consul
sudo mkdir /etc/consul.d
sudo chmod a+w /etc/consul.d
Test the install
consul version
*This step is to be performed by at least 3 members of the class on separate VMs
While logged into your server
consul agent -server -bootstrap-expect=3 \
-data-dir=/tmp/consul -node=server-<yourFirstName> -bind=<yourPrivateIP> \
-enable-script-checks=true -config-dir=/etc/consul.d -ui
Open a new ssh session back into your VM and verify Consul members
consul members
At this point you should only see yourself
*Optionally a 4th student can bootstrap a server as a client member
consul agent -data-dir=/tmp/consul -node=agent-<yourFirstName> \
-bind=<yourPrivateIP> -enable-script-checks=true -config-dir=/etc/consul.d -ui
consul join <privateIPofNeighbor>
Verify the number of Consul members
consul members
Each student should enter some kv data
consul kv put <firstName> <lastName>
consul kv get <firstName>
2 of the students that have a Consul agent running in server mode perform this step, one at a time and observe the behavior
pkill -9 consul
Observe what happens in your ssh session that was used to start the Consul agent in a previous step
*Have a student that DID NOT kill their consul service run
consul kv get <firstName>
pkill -9 consul
Observe what happens in your ssh session that was used to start the Consul agent in a previous step
*Have a student that DID NOT kill their consul service run
consul kv get <firstName>
What happens?
First and Second students return to their ssh session that was used to bootstrap their Consul server
up arrow to show the bootstrap command and press enter
Each student can now run
consul members
consul kv get <firstName>
What happens?
Close out all ssh windows. Instructor will destroy lab VMs