The following instructions are for instantiation of a kubernetes environment within a Virtual Machine managed by Vagrant.
Vagrant is a VM management software that maintains and configures VM environments. It achieves this through configuration that is set out in a Vagrantfile.
Extract the files within the config folder to a directory. Navigate to this directory in a terminal window.
The command vagrant up will boot a VM that is configured according to the Vagrantfile. The directory that houses the Vagrantfile is synchronised with the home directory of the VM. The VM will be created and run the setup script to instantiate a single node Kubernetes environment using microk8s.
Enter into the VM using the command vagrant ssh.
Check that the environment is correctly configured using the command kubectl cluster-info. If it returns an error, logout of the VM and use the command vagrant provision on your host machine. Re-enter the VM using vagrant ssh.
Once your cluster environment is working, enable the metallb load balancer using the command microk8s.enable metallb. It will prompt you for an IP range, for which you should enter 192.168.33.115-192.168.33.120. The IP address requested for the services exposed within this assignment will fall into this range. Use the command kubectl apply -f /vagrant/cafe.yaml to apply the deployment and service configurations required for load testing. Ensure that the cafe.yaml file is within the same directory as your Vagrantfile!
Use the command kubectl get all to verify that your services have been assigned external IP addresses. The running applications can be accessed on your host machine using the external IP with port 8080. This can be verified by opening the browser on your host machine and navigating to
In another terminal window, ssh into the vagrant machine using vagrant ssh. In this terminal, execute the command kubectl port-forward -n monitoring service/grafana –address 0.0.0.0 3000:3000. This exposes the Grafana dashboard that is used to visualise our deployed applications.
In your browser on your host machine, navigate to localhost:3000. This will bring up a login screen for Grafana. The username and password are admin. Explore the Grafana interface and interact with the existing dashboards to see aspects of cluster behaviour.
Extract Apache JMeter on your host machine. Create a testplan by Thread Groups that are responsible for HTTP Requests. Requests should be aimed at the external IP and port of exposed services. Add listeners to your Thread Groups to record performance observations. Load can be shaped by varying the number of threads created within the defined ramp up period, as well as utilisation of throughput shaping plugins found at https://jmeter-plugins.org/.
Resource allocations can be altered within the cafe.yaml file. Limits are the hard cap for resource consumption, while requests are minimum allocation requirements. You may alter these values for testing purposes, as well as the assigned replicas for each deployment. If you wish to add more deployments for testing, you can do so using the same syntax as used within
the file. Note: When applying resourcequotas, make sure you apply them to the correct namespace!
Horizontal Autoscaling can be implemented by using the command kubectl apply -f /vagrant/