Fri. Sep 30th, 2022

Hello Android

All android in one place

Deploy An Istio Application in Kubernetes

3 min read

Hello, readers. This article talks about the Deploy Sample Istio application in the Kubernetes environment.

So, let us begin!! 😊

Also read: Installation of Istio in a Kubernetes Cluster


Feature of Istio – At a Glance

  • Istio provides us with a service mesh monitoring and control unit by secured service to service communication using TLS encryption.
  • With Istio, we can enable traffic routing and monitoring of the services within the Kubernetes service through traffic observability features.
  • The entire traffic routing and distribution from within the cluster to the external services over the internet can be monitored by Istio through the Envoy proxy that runs as a sidecar to every Pod associated with the Service.

Istio’s control plane runs over the Kubernetes cluster. This makes it more feasible for us to deploy multiple microservice applications within the cluster.

In the upcoming section, we will be looking at the deployment of a sample microservice application in a Kubernetes cluster to demonstrate the features of Istio.


Deploying Sample Istio Application in Kubernetes

The Bookinfo application that we intend to deploy describes information about a specific book based on book details looked for.

Microservices involved in the Bookinfo Application-

Bookinfo Application Microservice Architecture
  • details service: This service contains information about a book.
  • productpage service: It does internal calls to reviews and details services to display information about a book.
  • reviews service: It contains reviews about a book.
  • ratings service: This service contains information about the ranking of a book with respect to its review.

There are three versions associated with the review service:

  1. The Version v1 does not give a call to the rating service.
  2. Version v2 does give a call to the rating service and displays the rating through black stars.
  3. Version v3 calls the rating service to display the rating using red stars.

Step 1: Enable Istio injection for the namespace

To deploy the Bookinfo application in a multi-tenant cluster, we just need an Istio enabled environment and Istio labels injected at namespace level as shown below-

kubectl label namespace default istio-injection=enabled

With this label injection, it attaches an Envoy sidecar to the container which monitors the traffic.


Step 2: Deploy the Sample App

Once the Istio injection is enabled, we are good to proceed with the deployment.

The folder of Istio release contains the YAML files for the bookinfo app deployment. We need to deploy the app under the samples/bookinfo/platform/kube folder using the below command-

kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml

Step 3: Validate the deployment

Having deployed the application, let us look for the services and resources been deployed in the cluster-

Image 9
Bookinfo Services
Image 10
Bookinfo Pods

To validate the accessibility to the application from within the cluster, we can use the below curl command from within a pod running in the same cluster-

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>"

Output:

<title>Simple Bookstore App</title>

Step 3: Deploy gateway for external accessibility of the application

For the application to be accessible from outside the cluster (from a browser), we need to configure an Istio gateway.

With an Istio gateway, the traffic hits the load balancer. And then, it validates itself at the gateway.

kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yaml

Once we deploy the gateway, we need to set the GATEWAY_URL variable to access the application as shown below-

export GATEWAY_URL=$INGRESS_HOST:$INGRESS_PORT

$INGRESS_HOST is the IP of the load balancer and the $INGRESS_PORT will be 80 or 443 depending upon the configuration setup.


Step 4: Validate the accessibility of the application from outside the cluster

In order to access the application from outside the cluster, point the browser to the below URL-

 http://$GATEWAY_URL/productpage

Output:

Image 11
Output

Conclusion

By this, we have reached the end of this topic. Feel free to comment below in case you come across any questions.

For more such posts related to Kubernetes and Istio, Stay tuned with us.

Till then, Happy Learning!! 🙂

www.hello-android.com

Leave a Reply

Your email address will not be published. Required fields are marked *

Hello android © All rights reserved. | Newsphere by AF themes.