DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Enterprise AI Trend Report: Gain insights on ethical AI, MLOps, generative AI, large language models, and much more.

2024 Cloud survey: Share your insights on microservices, containers, K8s, CI/CD, and DevOps (+ enter a $750 raffle!) for our Trend Reports.

PostgreSQL: Learn about the open-source RDBMS' advanced capabilities, core components, common commands and functions, and general DBA tasks.

AI Automation Essentials. Check out the latest Refcard on all things AI automation, including model training, data security, and more.

Related

  • Performance Optimization in Agile IoT Cloud Applications: Leveraging Grafana and Similar Tools
  • OpenTofu Vs. Terraform: The Great IaC Dilemma
  • Why We Built Smart Scaler
  • Achieving High Availability in CI/CD With Observability

Trending

  • Building a Sustainable Data Ecosystem
  • Top Secrets Management Tools for 2024
  • The Power of Generative AI: How It Is Revolutionizing Business Process Automation
  • The Future of Kubernetes: Potential Improvements Through Generative AI
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Monitoring and Observability
  4. How to Configure Istio, Prometheus and Grafana for Monitoring

How to Configure Istio, Prometheus and Grafana for Monitoring

Learn to configure metrics in Prometheus from Istio service mesh to understand Kubernetes application performance and visualize graphs of metrics using Grafana.

By 
Md Azmal user avatar
Md Azmal
·
Aug. 29, 23 · Tutorial
Like (7)
Save
Tweet
Share
3.7K Views

Join the DZone community and get the full member experience.

Join For Free

Intro to Istio Observability Using Prometheus

Istio service mesh abstracts the network from the application layers using sidecar proxies. You can implement security and advance networking policies to all the communication across your infrastructure using Istio. 

But another important feature of Istio is observability. You can use Istio to observe the performance and behavior of all your microservices in your infrastructure (see the image below). One of the primary responsibilities of Site reliability engineers (SREs) in large organizations is to monitor the golden metrics of their applications, such as CPU utilization, memory utilization, latency, and throughput. 

Istio Control Plane

In this article, we will discuss how SREs can benefit from integrating three open-source software- Istio, Prometheus, and Grafana. While Istio is the most famous service software, Prometheus is the most widely used monitoring software, and Grafana is the most famous visualization tool. 

Note: The steps are tested for Istio 1.17.X

Watch the Video of Istio, Prometheus, and Grafana Configuration

Watch the video if you want to follow the steps from the video:


Step 1: Go to Istio Add-Ons and Apply Prometheus and Grafana YAML File

First, go to the add-on folder in the Istio directory using the command. Since I am using 1.17.1, the path for me is istio-1.17.1/samples/addons

You will notice that Istio already provides a few YAML files to configure Grafana, Prometheus, Jaeger, Kiali, etc. You can configure Prometheus by using the following command:

Shell
 
kubectl apply -f prometheus.yaml
Shell
 
kubectl apply -f grafana.yaml


output when using the above command

Note these add-on YAMLs are applied to istio-system namespace by default. 

Apply Istio addon yaml files for Prometheus and Grafana in Kubernetes

Step 2: Deploy New Service and Port-Forward Istio Ingress Gateway

To experiment with the working model, we will deploy the httpbin service to an Istio-enabled namespace. We will create an object of the Istio ingress gateway to receive the traffic to the service from the public. 

We will create an object of the Istio ingress gateway to receive the traffic to the service from the public.

We will also port-forward the Istio ingress gateway to a particular port-7777. 

Deploy new service and port-forward Istio ingress gateway

You should see the below screen at localhost:7777

localhost:7777

Step 3: Open Prometheus and Grafana Dashboard

You can open the Prometheus dashboard by using the following command.

Shell
 
istioctl dashboard prometheus
Shell
 
istioctl dashboard grafana


Both the Grafana and Prometheus will open in the localhost. 

Open Prometheus and Grafana dashboard

Step 4: Make HTTP Requests From Postman

We will see how the httpbin service is consuming CPU or memory when there is a traffic load. We will create a few GET and POST requests to the localhost:7777 from the Postman app. 

We will create a few GET and POST requests to the localhost:7777 from the Postman app.

Once you GET or POST requests to httpbin service multiple times, there will be utilization of resources, and we can see them in Grafana. But at first, we need to configure the metrics for httpbin service in Prometheus and Grafana. 

Step 5: Configuring Metrics in Prometheus

One can select a range of metrics related to any Kubernetes resources such as API server, applications, workloads, envoy, etc.  We will select container_memory_working_set_bytes metrics for our configuration. 

In the Prometheus application, we will select the namespace to scrape the metrics using the following search term: container_memory_working_set_bytes { namespace= “istio-telemetry”} (istio-telemetry is the name of our Istio-enabled namespace, where httpbin service is deployed)

Note that, simply running this, we get the memory for our namespace. Since we want to analyze the memory usage of our pods, we can calculate the total memory consumed by summing the memory usage of each pod grouped by pod. The following query will help us in getting the desired result : sum(container_memory_working_set_bytes{namespace=”istio-telemetry”}) by (pod)

The following query will help us in getting the desired result : sum(container_memory_working_set_bytes{namespace=”istio-telemetry”}) by (pod)

Note: Prometheus provides a lot of flexibility to filter, slice, and dice the metric data. The central idea of this article was to showcase the ability of Istio to emit and send metrics to Prometheus for collection

Step 6: Configuring Istio Metrics Graphs in Grafana

Now, you can simply take the query sum(container_memory_working_set_bytes{namespace=”istio-telemetry”}) by (pod) in Prometheus and plot a graph with time.  All you need to do is create a new dashboard in Grafana and paste the query into the metrics browser. Grafana will plot a time-series graph. You can edit the graph with proper names, legends, and titles for sharing with other stakeholders in the Ops team.

Configuring Istio metrics graphs in Grafana

There are several ways to tweak and customize the data and depict the Prometheus metrics in Grafana. You can choose to make all the customization based on your enterprise needs. I have done a few experiments in the video; feel free to check it out. 

Conclusion

Istio service mesh is extremely powerful in providing overall observability across the infrastructure. In this article, we have just offered a small use case of metrics scrapping and visualization using Istio, Prometheus, and Grafana. You can perform logging and tracing of logs and real-time traffic using Istio; we will cover those topics in our subsequent blogs.

Grafana Open-source software Site reliability engineering

Published at DZone with permission of Md Azmal. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Performance Optimization in Agile IoT Cloud Applications: Leveraging Grafana and Similar Tools
  • OpenTofu Vs. Terraform: The Great IaC Dilemma
  • Why We Built Smart Scaler
  • Achieving High Availability in CI/CD With Observability

Partner Resources


Comments

ABOUT US

  • About DZone
  • Send feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: