mirror of https://github.com/istio/istio.io.git
Add "Istio Addons" Task (#524)
* merge * Update metrics task with comments from previous PR * Initial addons move commit * Update istioctl command * Update k8s install * wrap lines * Rename/move files
This commit is contained in:
parent
644c455425
commit
06a05930a0
|
|
@ -115,62 +115,6 @@ Starting with the {{ site.data.istio.version }} release, Istio is installed in i
|
|||
kubectl apply -f install/kubernetes/istio-initializer.yaml
|
||||
```
|
||||
|
||||
1. *Optional:* Install add-ons for metric collection and/or request tracing as described in the following sections.
|
||||
|
||||
### Enabling metrics collection
|
||||
|
||||
To collect and view metrics provided by Mixer, install [Prometheus](https://prometheus.io)
|
||||
as well as the [Grafana](https://grafana.com/grafana/download) and/or ServiceGraph add-ons.
|
||||
|
||||
```bash
|
||||
kubectl apply -f install/kubernetes/addons/prometheus.yaml
|
||||
kubectl apply -f install/kubernetes/addons/grafana.yaml
|
||||
kubectl apply -f install/kubernetes/addons/servicegraph.yaml
|
||||
```
|
||||
You can find out more about how to use these tools in [Collecting Metrics and Logs]({{home}}/docs/tasks/metrics-logs.html).
|
||||
|
||||
#### Verifying the Grafana dashboard
|
||||
|
||||
The Grafana add-on provides an Istio dashboard visualization of the metrics in the cluster
|
||||
such as request rates and success or failure rates. After you install Grafana, check that you can
|
||||
access the dashboard.
|
||||
|
||||
Configure port-forwarding for the `grafana` service:
|
||||
|
||||
```bash
|
||||
kubectl port-forward -n istio-system $(kubectl get pod -n istio-system -l app=grafana -o jsonpath='{.items[0].metadata.name}') 3000:3000 &
|
||||
```
|
||||
|
||||
Point your web browser to [http://localhost:3000/dashboard/db/istio-dashboard](http://localhost:3000/dashboard/db/istio-dashboard).
|
||||
The dashboard looks similar to the following:
|
||||
|
||||
<figure><img style="max-width:80%" src="./img/grafana_dashboard.png" alt="Grafana Istio Dashboard" title="Grafana Istio Dashboard" />
|
||||
<figcaption>Grafana Istio Dashboard</figcaption></figure>
|
||||
|
||||
#### Verifying the ServiceGraph service
|
||||
|
||||
The ServiceGraph add-on provides a textual (JSON) representation and a graphical visualization of the
|
||||
service interaction graph for the cluster. Like Grafana, you can access the servicegraph service using
|
||||
port-forwarding, service nodePort, or, if external load balancing is available, external IP. In this
|
||||
example the service name is `servicegraph` and the port to access is `8088`:
|
||||
|
||||
```bash
|
||||
kubectl port-forward -n istio-system $(kubectl get pod -n istio-system -l app=servicegraph -o jsonpath='{.items[0].metadata.name}') 8088:8088 &
|
||||
```
|
||||
|
||||
The ServiceGraph service provides both a textual (JSON) representation (via `/graph`) and a graphical
|
||||
visualization (via `/dotviz`) of the underlying service graph. If you configured port forwarding using
|
||||
the above command, you can view the graphical visualization by opening your browser at [http://localhost:8088/dotviz](http://localhost:8088/dotviz). You will see an empty page initially before you have any microservices deployed.
|
||||
|
||||
After you run some services, a service graph builds. For example, after installing the
|
||||
[BookInfo]({{home}}/docs/guides/bookinfo.html) sample application and generating some load on the
|
||||
application (e.g., executing `curl` requests in a `while` loop), the resulting service graph looks
|
||||
similar to the following:
|
||||
|
||||
<figure><img src="./img/servicegraph.png" alt="BookInfo Service Graph" title="BookInfo Service Graph" />
|
||||
<figcaption>BookInfo Service Graph</figcaption></figure>
|
||||
|
||||
|
||||
## Verifying the installation
|
||||
|
||||
1. Ensure the following Kubernetes services are deployed: `istio-pilot`, `istio-mixer`,
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 488 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 234 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 219 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 360 KiB |
|
|
@ -0,0 +1,257 @@
|
|||
---
|
||||
title: Using the Istio Add-ons
|
||||
|
||||
overview: This task shows you how to setup and use the Istio Addons, including Prometheus, Grafana, and Servicegraph.
|
||||
|
||||
order: 120
|
||||
|
||||
layout: docs
|
||||
type: markdown
|
||||
---
|
||||
{% include home.html %}
|
||||
|
||||
This task shows how to install and use the set of Istio add-ons. The add-ons
|
||||
include a Prometheus server with config to pull metrics from Istio endpoints, a
|
||||
Grafana server preconfigured with a default dashboard for monitoring an Istio
|
||||
service mesh, and an example ServiceGraph service that can generate a visual
|
||||
representation of an Istio service mesh.
|
||||
|
||||
The [BookInfo]({{home}}/docs/guides/bookinfo.html) sample application is used
|
||||
as the example application throughout this task.
|
||||
|
||||
## Before you begin
|
||||
* [Install Istio]({{home}}/docs/setup/) in your cluster and deploy an
|
||||
application.
|
||||
|
||||
## Using the Prometheus add-on
|
||||
|
||||
### Installation and Usage
|
||||
|
||||
1. To collect, view, and query the metrics provided by Mixer, install the
|
||||
Prometheus add-on.
|
||||
|
||||
In Kubernetes environments, execute the following command:
|
||||
|
||||
```bash
|
||||
kubectl apply -f install/kubernetes/addons/prometheus.yaml
|
||||
```
|
||||
|
||||
1. Verify that the service is running in your cluster.
|
||||
|
||||
In Kubernetes environments, execute the following command:
|
||||
|
||||
```bash
|
||||
kubectl -n istio-system get svc prometheus
|
||||
```
|
||||
|
||||
The output will be similar to:
|
||||
|
||||
```
|
||||
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
||||
prometheus 10.59.241.54 <none> 9090/TCP 2m
|
||||
```
|
||||
|
||||
1. Send traffic to the mesh.
|
||||
|
||||
For the BookInfo sample, visit `http://$GATEWAY_URL/productpage` in your web
|
||||
browser or issue the following command:
|
||||
|
||||
```bash
|
||||
curl http://$GATEWAY_URL/productpage
|
||||
```
|
||||
|
||||
1. Open the Prometheus UI.
|
||||
|
||||
In Kubernetes environments, execute the following command:
|
||||
|
||||
```bash
|
||||
kubectl -n istio-system port-forward $(kubectl -n istio-system get pod -l app=prometheus -o jsonpath='{.items[0].metadata.name}') 9090:9090 &
|
||||
```
|
||||
|
||||
Visit [http://localhost:9090/graph](http://localhost:9090/graph) in your web browser.
|
||||
|
||||
1. Execute a Prometheus query.
|
||||
|
||||
In the "Expression" input box at the top of the web page, enter the text:
|
||||
`request_count`. Then, click the **Execute** button.
|
||||
|
||||
The results will be similar to:
|
||||
|
||||
<figure><img style="max-width:100%" src="./img/prometheus_query_result.png" alt="Prometheus Query Result" title="Prometheus Query Result" />
|
||||
<figcaption>Prometheus Query Result</figcaption></figure>
|
||||
|
||||
### About the Prometheus Add-on
|
||||
|
||||
Mixer comes with a built-in [Prometheus](https://prometheus.io) adapter that
|
||||
exposes an endpoint serving generated metric values. The Prometheus add-on is a
|
||||
Prometheus server that comes pre-configured to scrape Mixer endpoints to collect
|
||||
the exposed metrics. It provides a mechanism for persistent storage and querying
|
||||
of Istio metrics. The Grafana add-on, for instance, uses this add-on as the
|
||||
source for all of the dashboard data.
|
||||
|
||||
The configured Prometheus add-on scrapes three endpoints:
|
||||
1. *istio-mesh* (`istio-mixer.istio-system:42422`): all Mixer-generated mesh
|
||||
metrics.
|
||||
1. *mixer* (`istio-mixer.istio-system:9093`): all Mixer-specific metrics. Used
|
||||
to monitor Mixer itself.
|
||||
1. *envoy* (`istio-mixer.istio-system:9102`): raw stats generated by Envoy (and
|
||||
translated from statsd to prometheus).
|
||||
|
||||
## Using the Grafana add-on
|
||||
|
||||
**NOTE**: Use of the Grafana add-on _requires_ use of the Prometheus add-on.
|
||||
|
||||
### Installation and Usage
|
||||
|
||||
1. To view Istio metrics in a graphical dashboard install the Grafana add-on.
|
||||
|
||||
In Kubernetes environments, execute the following command:
|
||||
|
||||
```bash
|
||||
kubectl apply -f install/kubernetes/addons/grafana.yaml
|
||||
```
|
||||
|
||||
1. Verify that the service is running in your cluster.
|
||||
|
||||
In Kubernetes environments, execute the following command:
|
||||
|
||||
```bash
|
||||
kubectl -n istio-system get svc grafana
|
||||
```
|
||||
|
||||
The output will be similar to:
|
||||
|
||||
```
|
||||
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
||||
grafana 10.59.247.103 <none> 3000/TCP 2m
|
||||
```
|
||||
|
||||
1. Open the Istio Dashboard via the Grafana UI.
|
||||
|
||||
In Kubernetes environments, execute the following command:
|
||||
|
||||
```bash
|
||||
kubectl -n istio-system port-forward $(kubectl -n istio-system get pod -l app=grafana -o jsonpath='{.items[0].metadata.name}') 3000:3000 &
|
||||
```
|
||||
|
||||
Visit [http://localhost:3000/dashboard/db/istio-dashboard](http://localhost:3000/dashboard/db/istio-dashboard) in your web browser.
|
||||
|
||||
The Istio Dashboard will look similar to:
|
||||
|
||||
<figure><img style="max-width:100%" src="./img/grafana-istio-dashboard.png" alt="Istio Dashboard" title="Istio Dashboard" />
|
||||
<figcaption>Istio Dashboard</figcaption></figure>
|
||||
|
||||
1. Send traffic to the mesh.
|
||||
|
||||
For the BookInfo sample, visit `http://$GATEWAY_URL/productpage` in your web
|
||||
browser or issue the following command:
|
||||
|
||||
```bash
|
||||
curl http://$GATEWAY_URL/productpage
|
||||
```
|
||||
|
||||
Refresh the page a few times (or send the command a few times) to generate a
|
||||
small amount of traffic.
|
||||
|
||||
Look at the Istio Dashboard again. It should reflect the traffic that was
|
||||
generated. It will look similar to:
|
||||
|
||||
<figure><img style="max-width:100%" src="./img/dashboard-with-traffic.png"
|
||||
alt="Istio Dashboard With Traffic" title="Istio Dashboard With Traffic" />
|
||||
<figcaption>Istio Dashboard With Traffic</figcaption></figure>
|
||||
|
||||
|
||||
### About the Grafana add-on
|
||||
|
||||
The Grafana add-on is a pre-configured instance of Grafana. The base image
|
||||
([`grafana/grafana:4.1.2`](https://hub.docker.com/r/grafana/grafana/)) has been
|
||||
modified to start with both a Prometheus data source and the Istio Dashboard
|
||||
installed. The base install files for Istio, and Mixer in particular, ship with
|
||||
a default configuration of global (used for every service) metrics. The Istio
|
||||
Dashboard is built to be used in conjunction with the default Istio metrics
|
||||
configuration and a Prometheus backend.
|
||||
|
||||
The Istio Dashboard consists of three main sections:
|
||||
1. A Global Summary View. This section provides high-level summary of HTTP
|
||||
requests flowing through the service mesh.
|
||||
1. A Mesh Summary View. This section provides slightly more detail than the
|
||||
Global Summary View, allowing per-service filtering and selection.
|
||||
1. Individual Services View. This section provides metrics about requests and
|
||||
responses for each individual service within the mesh (HTTP and TCP).
|
||||
|
||||
For more on how to create, configure, and edit dashboards, please see the
|
||||
[Grafana documentation](http://docs.grafana.org/).
|
||||
|
||||
## Using the Servicegraph add-on
|
||||
|
||||
**NOTE**: Use of the Grafana add-on _requires_ use of the Prometheus add-on.
|
||||
|
||||
1. To view a graphical representation of your service mesh, install the
|
||||
Servicegraph add-on.
|
||||
|
||||
In Kubernetes environments, execute the following command:
|
||||
|
||||
```bash
|
||||
kubectl apply -f install/kubernetes/addons/servicegraph.yaml
|
||||
```
|
||||
|
||||
1. Verify that the service is running in your cluster.
|
||||
|
||||
In Kubernetes environments, execute the following command:
|
||||
|
||||
```bash
|
||||
kubectl -n istio-system get svc servicegraph
|
||||
```
|
||||
|
||||
The output will be similar to:
|
||||
|
||||
```
|
||||
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
||||
servicegraph 10.59.253.165 <none> 8088/TCP 30s
|
||||
```
|
||||
|
||||
1. Send traffic to the mesh.
|
||||
|
||||
For the BookInfo sample, visit `http://$GATEWAY_URL/productpage` in your web
|
||||
browser or issue the following command:
|
||||
|
||||
```bash
|
||||
curl http://$GATEWAY_URL/productpage
|
||||
```
|
||||
|
||||
Refresh the page a few times (or send the command a few times) to generate a
|
||||
small amount of traffic.
|
||||
|
||||
1. Open the Servicegraph UI.
|
||||
|
||||
In Kubernetes environments, execute the following command:
|
||||
|
||||
```bash
|
||||
kubectl -n istio-system port-forward $(kubectl -n istio-system get pod -l app=servicegraph -o jsonpath='{.items[0].metadata.name}') 8088:8088 &
|
||||
```
|
||||
|
||||
Visit [http://localhost:8088/dotviz](http://localhost:8088/dotviz) in your web browser.
|
||||
|
||||
The results will look similar to:
|
||||
|
||||
<figure><img style="max-width:100%" src="./img/servicegraph-example.png" alt="Example Servicegraph" title="Example Servicegraph" />
|
||||
<figcaption>Example Servicegraph</figcaption></figure>
|
||||
|
||||
### About the Servicegraph Add-on
|
||||
|
||||
The Servicegraph service is an example service that provides endpoints for
|
||||
generating and visualizing a graph of services within a mesh. It exposes the
|
||||
following endpoints:
|
||||
|
||||
- `/graph` which provides a JSON serialization of the servicegraph
|
||||
- `/dotgraph` which provides a dot serialization of the servicegraph
|
||||
- `/dotviz` which provides a visual representation of the servicegraph
|
||||
|
||||
All endpoints take an optional argument of `time_horizon`, which controls the
|
||||
timespan to consider for graph generation.
|
||||
|
||||
All endpoints also take an optional argument of `filter_empty=true`, which will
|
||||
restrict the nodes and edges shown to only those that reflect non-zero traffic
|
||||
levels during the specified `time_horizon`.
|
||||
|
||||
The Servicegraph example is built on top of Prometheus queries.
|
||||
|
|
@ -123,7 +123,7 @@ as the example application throughout this task.
|
|||
1. Push the new configuration.
|
||||
|
||||
```bash
|
||||
istioctl apply -f new_telemetry.yaml
|
||||
istioctl create -f new_telemetry.yaml
|
||||
```
|
||||
|
||||
The expected output is similar to:
|
||||
|
|
|
|||
Loading…
Reference in New Issue