Multipass Kubernetes setup for a simple 2 node cluster
Before this script is executed, edit the MOUNTDIR to point to the directory that needs to be mounted
% ./mpinstall.sh
Now let's check to make sure that the VMs are running
% multipass list
Name State IPv4 Image
mnode Running 192.168.64.7 Ubuntu 18.04 LTS
wnode1 Running 192.168.64.9 Ubuntu 18.04 LTSaOnce the installation is complete it will create a file hosts.mpls
with IPv4 and hostname entries for all the mosts created by multipass
Please use multipass transfer command to transfer these files to each unit
and append on each hosts /etc/hosts file.
or you can use multipass shell into each VM and append the hosts.mpls file
% ./kinstall.shNow let's make sure we can do a simple kubectl command on the master
% multipass exec mnode -- sudo /snap/bin/kubectl get no
NAME STATUS ROLES AGE VERSION
mnode Ready master 2d5h v1.18.0Now we want to make sure that the worker node joins the cluster
% ./kmjoin.shThis will print a join command that needs to run on the worker node
% microk8s join 192.168.64.7:25000/HNfCnPyUHamYteGNIrDobhJiGiRlPaeQNow check to make sure that the Cluster labelled and it is up
% ./klabel.sh
% multipass exec mnode -- sudo /snap/bin/kubectl get no
NAME STATUS ROLES AGE VERSION
mnode Ready master 2d6h v1.18.0
wnode1 Ready worker 2d5h v1.18.0Now Let's load the mysql container on a PVC Claim created on a local directory Edit the variable hostPath in the file mysql-pv.yaml to point to the directory that the mysql instance will use as a Voume for the database
Now crete the PV first for mysql on mnode
% kubectl apply -f mysql-pv.yamlNow we kick off the MySQL instance container on this PV no mnode
% kubectl apply -f mysql-deployment.yamlCheck to see that the deployment is there on mnode
% kubectl get deploymentsWhile we are at it , let's crete a simple nginx deployment instance
% ./knginx.shCheck the deployments again and see that both are running
% kubectl get deployments