Home Explore Blog CI



kubernetes

4th chunk of `content/en/blog/_posts/2017-05-00-Managing-Microservices-With-Istio-Service-Mesh.md`
0df5fa0cc75649a2b84a6c7030e9f3e3d84b3d527f15f1b40000000100000896
![](https://lh3.googleusercontent.com/AP3bEJR9uqsXufk5kZqD4DaRUs9ynuybfM8KBJlv_sF0g6A8LRO606jr_Z8xL71TrKWt_OfTXDJCcISZGy6ucj4KVZVFPFT8NCOOf6PpEZ0XVKlw-fgRP0iJvaBKuZaH-dySdJZ-)




**Running the Bookinfo Application with Istio**  

Now that we’ve seen the app, we’ll adjust our deployment slightly to make it work with Istio. We first need to [install Istio](https://istio.io/docs/tasks/installing-istio.html) in our cluster. To see all of the metrics and tracing features in action, we also install the optional Prometheus, Grafana, and Zipkin addons. We can now delete the previous app and start the Bookinfo app again using the exact same yaml file, this time with Istio:



 ```
kubectl delete -f bookinfo-v1.yaml

kubectl apply -f \<(istioctl kube-inject -f bookinfo-v1.yaml)
  ```



Notice that this time we use the istioctl kube-inject command to modify bookinfo-v1.yaml before creating the deployments. It injects the Envoy sidecar into the Kubernetes pods as documented [here](https://istio.io/docs/reference/commands/istioctl.html#istioctl-kube-inject). Consequently, all of the microservices are packaged with an Envoy sidecar that manages incoming and outgoing traffic for the service.  


In the Istio service mesh we will not want to access the application **productpage** directly, as we did in plain Kubernetes. Instead, we want an Envoy sidecar in the request path so that we can use Istio’s management features (version routing, circuit breakers, policies, etc.) to control external calls to **productpage** , just like we can for internal requests. Istio’s Ingress controller is used for this purpose.  


To use the Istio Ingress controller, we need to create a Kubernetes [Ingress resource](https://raw.githubusercontent.com/istio/istio/master/samples/bookinfo/platform/kube/bookinfo-ingress.yaml) for the app, annotated with kubernetes.io/ingress.class: "istio", like this:



 ```
cat \<\<EOF  ``` kubectl create -f -

apiVersion: extensions/v1beta1

kind: Ingress

metadata:

 name: bookinfo

 annotations:

   kubernetes.io/ingress.class: "istio"

spec:

 rules:

 - http:

     paths:

     - path: /productpage

       backend:

         serviceName: productpage

Title: Running the Bookinfo Application with Istio and Envoy Sidecar Injection
Summary
To run the Bookinfo application with Istio, Istio needs to be installed in the cluster along with optional addons like Prometheus, Grafana, and Zipkin. The previously deployed app is deleted and re-deployed using the same YAML file, but this time, the 'istioctl kube-inject' command is used to inject the Envoy sidecar proxy into the Kubernetes pods. This sidecar manages all incoming and outgoing traffic. Instead of directly accessing the 'productpage', the Istio Ingress controller is used. This requires creating a Kubernetes Ingress resource annotated with 'kubernetes.io/ingress.class: "istio"'.