Bookinfo with a Virtual Machine
This example deploys the Bookinfo application across Kubernetes with one service running on a virtual machine (VM), and illustrates how to control this infrastructure as a single mesh.
Overview
Before you begin
Setup Istio by following the instructions in the Virtual Machine Installation guide4.
Deploy the Bookinfo5 sample application (in the
bookinfo
namespace).Create a VM and add it to the
vm
namespace, following the steps in Configure the virtual machine.
Running MySQL on the VM
We will first install MySQL on the VM, and configure it as a backend for the ratings service. All commands below should be run on the VM.
Install mariadb
:
Set up authentication:
You can find details of configuring MySQL at Mysql6.
On the VM add ratings database to mysql.
To make it easy to visually inspect the difference in the output of the Bookinfo application, you can change the ratings that are generated by using the following commands to inspect the ratings:
and to change the ratings
Expose the mysql service to the mesh
When the virtual machine is started, it will automatically be registered into the mesh. However, just like when creating a Pod, we still need to create a Service before we can easily access it.
Using the mysql service
The ratings service in Bookinfo will use the DB on the machine. To verify that it works, create version 2 of the ratings service that uses the mysql db on the VM. Then specify route rules that force the review service to use the ratings version 2.
Create route rules that will force Bookinfo to use the ratings back end:
You can verify the output of the Bookinfo application is showing 1 star from Reviewer1 and 4 stars from Reviewer2 or change the ratings on your VM and see the results.
Reaching Kubernetes services from the virtual machine
In the above example, we treated our virtual machine as only a server. We can also seamlessly call Kubernetes services from our virtual machine:
Istio’s DNS proxying9 automatically configures DNS for the virtual machine, allowing us to make calls to Kubernetes hostnames.
Cleanup
Delete the
Bookinfo
sample application and its configuration following the steps inBookinfo
cleanup.Delete the
mysqldb
Service:Cleanup the VM following the steps in virtual-machine uninstall.