# Cloud Native Observability This appspace aims to provide you with cloud-native microservices architecture and how you can leverage tools for observability. To ease we have created a kubernetes cluster and pointed to it in your system. You can verify it. ``` kubectl cluster-info ``` ## Deployment: The section contains 10-tier Microservices application for a web-based e-commerce platform written in different languages and they talk to each other. We already placed the deployment files in the **handson** directory of the web terminal image **Deploy workloads** ``` kubectl apply -f handson/kubernetes-manifests.yaml ``` **Deploy Virtualservices and Gateway** We already deployed [istio ](https://istio.io/) to connect, secure, control, and observe services. ``` kubectl apply -f istio-manifests.yaml ``` You could see each pod has a special side-car envoy proxy running throughout your environment that intercepts all network communication between microservices You could see 10 microservices and their correspoding resource objects. Wait till all pods are ready. ``` watch kubectl get pods ``` ``` NAME READY STATUS RESTARTS AGE pod/adservice-6759f54c89-pv5wm 2/2 Running 0 11h pod/checkoutservice-cf87949cb-ws987 2/2 Running 0 11h pod/currencyservice-76fcbdf5f-hch7r 2/2 Running 0 11h pod/emailservice-7cf8496bc8-cc8gm 2/2 Running 0 11h pod/frontend-6c8d7df656-n49rf 2/2 Running 0 11h pod/loadgenerator-5fcb7c5f76-6h8kl 2/2 Running 0 11h pod/paymentservice-f5fff455-86whd 2/2 Running 0 11h pod/productcatalogservice-8459f66f56-lq8cg 2/2 Running 0 11h pod/recommendationservice-5bbb4f867f-gcnxv 2/2 Running 0 11h pod/shippingservice-7d7cdf797-2ddzx 2/2 Running 0 11h ``` ## Access the application Get the ingress-gateway IP ``` kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}' ``` Open browser url with http://<IP> ![](https://i.imgur.com/nTtu1Qf.jpg) ## Observability Observability involves collecting logs, metrics, tracing the traffic and visualizing the service mesh. We will go through tracing and logging ## Observe Traffic flow To have a graphical view , we deployed [kiali ](https://kiali.io/) to observe the service mesh and see the traffic flow. Get the kiali pod name to port-forward :+1: ``` kubectl get pods -l app=kiali -n istio-system -o jsonpath='{.items[0].metadata.name}' kubectl port-forward <POD_name> -n istio-system 20001:20001 ``` Open browser with url http://localhost:20001/ Credentials: admin/admin ![](https://i.imgur.com/ImGfygB.png) Click on `Graph Tab` When you observe there is load generator pod which keeps on sending requests to frontend microservice and in turn frontend connects to all other microservices. Click in each microservice and you can see the traffic flow in it. ![](https://i.imgur.com/T6ILeei.png) You can monitor complete workloads flow, and service flows. Close the opened port-forward by pressing `ctrl+c` ## Observe Tracing: As on-the-ground microservice practitioners are quickly realizing, the majority of operational problems that arise when moving to a distributed architecture are ultimately grounded in two areas: **networking and observability.** [Jaeger](https://www.jaegertracing.io/) helps to troubleshoot microservices-based distributed systems. Jaeger is already deployed along with istio ``` kubectl get pods -l app=jaeger -n istio-system -o jsonpath='{.items[0].metadata.name}' kubectl port-forward <POD-NAME> -n istio-system 16686:16686 ``` **Note** : While copying ignore quotes `'kiali....'` Open browser with url http://localhost:16686/ ![](https://i.imgur.com/bz14l4c.png) Select the service and find the traces of it. You can drill down to each request call. For more info on [istio](https://istio.io/) and [Observability](https://istio.io/docs/tasks/observability/)... ## Monitoring You can get your control plane and workload metrics from Grafana Dashboard kubectl get pods -l app=grafana -n istio-system -o jsonpath='{.items[0].metadata.name}' kubectl port-forward <POD NAME> 3000 -n istio-system **Note** : While copying ignore quotes `'grafana....'` Open browser with url http://localhost:3000 Navigate to Home --> Istio --> Istio Workload Dashboard Select `default` namespace ### Clear the environment ``` kubectl delete -f kubernetes-manifests.yaml kubectl delete -f istio-manifests.yaml ``` Happy Solving :tada: