Deploying a sample Microservice Application using Kubernetes and Istio Service Mesh — Part 3
This article is the first of the 3 part series
- Install Ubuntu 20.01 on Oracle VirtualBox
- Install Docker & Kubernetes using Minikube on Ububtu OS
- Install Istio and Deploy the sample Microservice application
Part 3: Install Istio, deploy a sample Application and visualize the traffic flow in the Kiali Dashboard
Approx. time required : 60–90 minutes
Start the VM and open a New Terminal (Ctrl + Alt + T) & Start minikube
minikube start
Download Istio package and add the current directory to the Env Path
curl -L https://istio.io/downloadIstio | sh -cd istio-1.14.1export PATH=$PWD/bin:$PATH
Note : The version if Istio downloaded might vary in your case and you need to switch to the appropriate directory
Install Istio & label namespace for automatic injection of sidecar containers
istioctl install --set profile=demo -ykubectl label namespace default istio-injection=enabled
Note : For the installation, we would utilize the ‘demo’ configuration profile. It is chosen so as to have a good set of defaults for our testing.
If all went well with the Istio installation, it should look something like below
Deploy the sample ‘bookinfo’ application that is part of the package
kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yamlkubectl get serviceskubectl get pods
Note : Re-run the last command & wait until all the pods report a ‘READY 2/2’ and ‘Running’ before you porced to the next step. This might take a few minutes depending on your system configurations.
Execute the below command to verify that the application is working as expected. The output confirms that the deployed app is running inside the cluster and serving the requeted content.
kubectl exec “$(kubectl get pod -l app=ratings -o jsonpath=’{.items[0].metadata.name}’)” -c ratings — curl -sS productpage:9080/productpage | grep -o “<title>.*</title>”
Open the application to outside traffic by associating this application with the Istio gateway
kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yaml
Verify that there are no issues with the Istio configuration
istioctl analyze
Determining the ingress IP and ports
Run this command in a new terminal window to start a Minikube tunnel that sends traffic to your Istio Ingress Gateway. This will provide an external load balancer, EXTERNAL-IP, for service/istio-ingressgateway.
minikube tunnel
Follow these instructions to set the INGRESS_HOST and INGRESS_PORT variables for accessing the gateway
export INGRESS_HOST=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}')export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].port}')export SECURE_INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="https")].port}')echo "$INGRESS_HOST"echo "$INGRESS_PORT"echo "$SECURE_INGRESS_PORT"
Set the Gateway URL using which we can access the application
export GATEWAY_URL=$INGRESS_HOST:$INGRESS_PORTecho "$GATEWAY_URL"echo "http://$GATEWAY_URL/productpage"
Paste the output from the previous command into your web browser and confirm that the Bookinfo product page is displayed
Visualizing your application & Traffic Flow
Install Kiali and the other addons and wait for them to be deployed.
kubectl apply -f samples/addonskubectl rollout status deployment/kiali -n istio-system
Note : If there are errors trying to install the addons, try running the command again. There may be some timing issues which will be resolved when the command is run again.
Access the Kiali Dashboard
istioctl dashboard kiali
In the left navigation menu, select Graph and in the Namespace drop down, select default.
Note : To see trace data, you must send requests to your service. The number of requests depends on Istio’s sampling rate. You set this rate when you install Istio. The default sampling rate is 1%. You need to send at least 100 requests before the first trace is visible.
To send around a 1000 requests to the productpage service, use the following command:
for i in $(seq 1 1000); do curl -s -o /dev/null "http://$GATEWAY_URL/productpage"; done
The Kiali dashboard shows an overview of your mesh with the relationships between the services in the Bookinfo
sample application. It also provides filters to visualize the traffic flow.
This concludes the three part series of the Istio and Kiali sample application deployment.
Thank You everyone for viewing this article. Please share and leave your comments.
Thank You !