|
1 | 1 | # Monitoring, Logging and Tracing Installation
|
2 | 2 |
|
3 |
| -Knative Serving offers two different monitoring setups: |
4 |
| -One that uses Elasticsearch, Kibana, Prometheus and Grafana and |
5 |
| -another that uses Stackdriver, Prometheus and Grafana. See below |
6 |
| -for installation instructions for these two setups. You can install |
7 |
| -only one of these two setups and side-by-side installation of these two are not supported. |
| 3 | +Knative Serving offers two different monitoring setups: |
| 4 | +[Elasticsearch, Kibana, Prometheus and Grafana](#Elasticsearch,-Kibana,-Prometheus-&-Grafana-Setup) |
| 5 | +or |
| 6 | +[Stackdriver, Prometheus and Grafana](#Stackdriver,-Prometheus-&-Grafana-Setup). |
| 7 | +You can install only one of these two setups and side-by-side installation of |
| 8 | +these two are not supported. |
8 | 9 |
|
9 | 10 | ## Elasticsearch, Kibana, Prometheus & Grafana Setup
|
10 | 11 |
|
11 |
| -*If you installed Knative Serving using [Easy Install](../install/README.md#Installing-Knative) guide, |
12 |
| -skip this step and continue to [Create Elasticsearch Indices](#Create-Elasticsearch-Indices)* |
| 12 | +If you installed the |
| 13 | +[full Knative release](../install/README.md#Installing-Knative), |
| 14 | +skip this step and continue to |
| 15 | +[Create Elasticsearch Indices](#Create-Elasticsearch-Indices) |
| 16 | + |
| 17 | +- Install Knative monitoring components: |
| 18 | + |
| 19 | + ```shell |
| 20 | + kubectl apply -R -f config/monitoring/100-common \ |
| 21 | + -f config/monitoring/150-elasticsearch \ |
| 22 | + -f third_party/config/monitoring/common \ |
| 23 | + -f third_party/config/monitoring/elasticsearch \ |
| 24 | + -f config/monitoring/200-common \ |
| 25 | + -f config/monitoring/200-common/100-istio.yaml |
| 26 | + ``` |
| 27 | + |
| 28 | +- The installation is complete when logging & monitoring components are all |
| 29 | + reported `Running` or `Completed`: |
| 30 | + |
| 31 | + ```shell |
| 32 | + kubectl get pods -n monitoring --watch |
| 33 | + ``` |
| 34 | + |
| 35 | + ``` |
| 36 | + NAME READY STATUS RESTARTS AGE |
| 37 | + elasticsearch-logging-0 1/1 Running 0 2d |
| 38 | + elasticsearch-logging-1 1/1 Running 0 2d |
| 39 | + fluentd-ds-5kc85 1/1 Running 0 2d |
| 40 | + fluentd-ds-vhrcq 1/1 Running 0 2d |
| 41 | + fluentd-ds-xghk9 1/1 Running 0 2d |
| 42 | + grafana-798cf569ff-v4q74 1/1 Running 0 2d |
| 43 | + kibana-logging-7d474fbb45-6qb8x 1/1 Running 0 2d |
| 44 | + kube-state-metrics-75bd4f5b8b-8t2h2 4/4 Running 0 2d |
| 45 | + node-exporter-cr6bh 2/2 Running 0 2d |
| 46 | + node-exporter-mf6k7 2/2 Running 0 2d |
| 47 | + node-exporter-rhzr7 2/2 Running 0 2d |
| 48 | + prometheus-system-0 1/1 Running 0 2d |
| 49 | + prometheus-system-1 1/1 Running 0 2d |
| 50 | + ``` |
| 51 | + |
| 52 | + CTRL+C to exit watch. |
13 | 53 |
|
| 54 | +### Create Elasticsearch Indices |
14 | 55 |
|
15 |
| -Run: |
16 |
| - |
17 |
| -```shell |
18 |
| -kubectl apply -R -f config/monitoring/100-common \ |
19 |
| - -f config/monitoring/150-elasticsearch \ |
20 |
| - -f third_party/config/monitoring/common \ |
21 |
| - -f third_party/config/monitoring/elasticsearch \ |
22 |
| - -f config/monitoring/200-common \ |
23 |
| - -f config/monitoring/200-common/100-istio.yaml |
24 |
| -``` |
| 56 | +To visualize logs with Kibana, you need to set which Elasticsearch indices to explore. We will create two indices in Elasticsearch using `Logstash` for application logs and `Zipkin` |
| 57 | +for request traces. |
25 | 58 |
|
26 |
| -Monitor logging & monitoring components, until all of the components report Running or Completed: |
| 59 | +- To open the Kibana UI (the visualization tool for |
| 60 | + [Elasticsearch](https://info.elastic.co)), start a local proxy with the |
| 61 | + following command: |
27 | 62 |
|
28 |
| -```shell |
29 |
| -kubectl get pods -n monitoring --watch |
30 |
| -``` |
| 63 | + ```shell |
| 64 | + kubectl proxy |
| 65 | + ``` |
31 | 66 |
|
32 |
| -CTRL+C when it's done. |
| 67 | + This command starts a local proxy of Kibana on port 8001. For security |
| 68 | + reasons, the Kibana UI is exposed only within the cluster. |
33 | 69 |
|
34 |
| -### Create Elasticsearch Indices |
35 |
| -We will create two indexes in ElasticSearch - one for application logs and one for request traces. |
36 |
| -To create the indexes, open Kibana Index Management UI at this [link](http://localhost:8001/api/v1/namespaces/monitoring/services/kibana-logging/proxy/app/kibana#/management/kibana/index) |
37 |
| -(*it might take a couple of minutes for the proxy to work the first time after the installation*). |
| 70 | +- Navigate to the |
| 71 | + [Kibana UI](http://localhost:8001/api/v1/namespaces/monitoring/services/kibana-logging/proxy/app/kibana). |
| 72 | + _It might take a couple of minutes for the proxy to work_. |
38 | 73 |
|
39 |
| -Within the "Configure an index pattern" page, enter `logstash-*` to `Index pattern` and select `@timestamp` |
40 |
| -from `Time Filter field name` and click on `Create` button. See below for a screenshot: |
| 74 | +- Within the "Configure an index pattern" page, enter `logstash-*` to |
| 75 | + `Index pattern` and select `@timestamp` from `Time Filter field name` and |
| 76 | + click on `Create` button. |
41 | 77 |
|
42 | 78 | 
|
43 | 79 |
|
44 |
| -To create the second index, select `Create Index Pattern` button on top left of the page. |
45 |
| -Enter `zipkin*` to `Index pattern` and select `timestamp_millis` from `Time Filter field name` |
46 |
| -and click on `Create` button. |
| 80 | +- To create the second index, select `Create Index Pattern` button on top left |
| 81 | + of the page. Enter `zipkin*` to `Index pattern` and select `timestamp_millis` |
| 82 | + from `Time Filter field name` and click on `Create` button. |
| 83 | + |
47 | 84 |
|
48 |
| -Next, visit instructions below to access to logs, metrics and traces: |
| 85 | +## Stackdriver, Prometheus & Grafana Setup |
49 | 86 |
|
50 |
| -* [Accessing Logs](./accessing-logs.md) |
51 |
| -* [Accessing Metrics](./accessing-metrics.md) |
52 |
| -* [Accessing Traces](./accessing-traces.md) |
| 87 | +If your Knative Serving is not built on a Google Cloud Platform (GCP) based |
| 88 | +cluster or you want to send logs to another GCP project, you need to build your |
| 89 | +own Fluentd image and modify the configuration first. See |
53 | 90 |
|
54 |
| -## Stackdriver(logs), Prometheus & Grafana Setup |
| 91 | +1. Install |
| 92 | + [Fluentd image on Knative Serving](https://github.com/knative/serving/blob/master/image/fluentd/README.md). |
| 93 | +2. [Set up a logging plugin](setting-up-a-logging-plugin.md). |
| 94 | +3. Install Knative monitoring components: |
55 | 95 |
|
56 |
| -If your Knative Serving is not built on a GCP based cluster or you want to send logs to |
57 |
| -another GCP project, you need to build your own Fluentd image and modify the |
58 |
| -configuration first. See |
| 96 | + ```shell |
| 97 | + kubectl apply -R -f config/monitoring/100-common \ |
| 98 | + -f config/monitoring/150-stackdriver-prod \ |
| 99 | + -f third_party/config/monitoring/common \ |
| 100 | + -f config/monitoring/200-common \ |
| 101 | + -f config/monitoring/200-common/100-istio.yaml |
| 102 | + ``` |
59 | 103 |
|
60 |
| -1. [Fluentd image on Knative Serving](/image/fluentd/README.md) |
61 |
| -2. [Setting up a logging plugin](setting-up-a-logging-plugin.md) |
| 104 | +## Learn More |
62 | 105 |
|
63 |
| -```shell |
64 |
| -kubectl apply -R -f config/monitoring/100-common \ |
65 |
| - -f config/monitoring/150-stackdriver \ |
66 |
| - -f third_party/config/monitoring/common \ |
67 |
| - -f config/monitoring/200-common \ |
68 |
| - -f config/monitoring/200-common/100-istio.yaml |
69 |
| -``` |
| 106 | +- Learn more about accessing logs, metrics, and traces: |
| 107 | + - [Accessing Logs](./accessing-logs.md) |
| 108 | + - [Accessing Metrics](./accessing-metrics.md) |
| 109 | + - [Accessing Traces](./accessing-traces.md) |
70 | 110 |
|
71 | 111 | ---
|
72 | 112 |
|
|
0 commit comments