-
Notifications
You must be signed in to change notification settings - Fork 3
Observability with Istio 1.9 #67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
StuartHarris
wants to merge
12
commits into
master
Choose a base branch
from
prometheus
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
5056b2f
update kube-state-metrics to support k8s 1.17
StuartHarris f2ec895
install prometheus
StuartHarris 731ed9e
attempt at sidecar configuratio for prometheus
StuartHarris 1e7241a
Add OUTPUT_CERTS env and volumeMount directly to istio container config
TimboTambo e2b4980
Add security context for prometheus container
TimboTambo f31119f
use kustomize to setup manifests before sidecar injection
StuartHarris 82311c4
add configmap
StuartHarris 64cb88a
tidy up, add readme etc
StuartHarris 5e578bd
update kube-state-metrics manifests
StuartHarris 52f5741
remove install.yaml files
StuartHarris fdcd676
ignore install.yaml
StuartHarris 0c614e0
Add restart proxies make command and remove telemetry from profile
TimboTambo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| # Monitoring | ||
|
|
||
| ## AKS | ||
|
|
||
| Azure Kubernetes Service (AKS) provides good high-level monitoring of the cluster, such as the CPU and memory usage of each node in the cluster. To view this find the cluster in the Azure portal and then click on the "Insights" tab. | ||
|
|
||
| ## Custom dashboards | ||
|
|
||
| We have custom dashboards for the doc-index-updater that can be found by searching for "Shared Dashboards" in the Azure Portal. | ||
|
|
||
| They are set up in the following way: | ||
|
|
||
| - [Prometheus](https://prometheus.io/) scrapes metrics from different pods in the cluster (such as [Istio](https://istio.io/) and [kube-state-metrics](https://github.com/kubernetes/kube-state-metrics#overview)). | ||
| - [Azure's OMS agent](https://docs.microsoft.com/en-us/azure/azure-monitor/platform/log-analytics-agent) scrapes this data and adds it to the logs analytics workspace for the cluster. | ||
| - The Azure Monitor dashboard runs queries against the log analytics workspace and plots the results. | ||
|
|
||
| ### Prometheus | ||
|
|
||
| Prometheus is no longer installed by Istio, so we have a set of [manifests](./prometheus) for that. | ||
|
|
||
| There are two parts to the [config](./prometheus/overlay/prometheus-cm.yaml): | ||
|
|
||
| - `prometheus.yml` specifies what pods to scrape and other general settings | ||
| - `prometheus.rules.yml` specifies some [Prometheus rules](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/), basically each rule is a query that Prometheus runs regularly and stores the results as a new metric. These are what we export to the Azure Monitor (by setting the `azure_monitor: true` label for each rule, see the Azure OMS agent section below). | ||
|
|
||
| Prometheus [stores its data locally on disk](https://prometheus.io/docs/prometheus/latest/storage/). This means that if the Prometheus pod is deleted then Prometheus's database is deleted as well. **This happens if you run `make` in the deployments repo** in order to force Prometheus to refresh its config. It is possible to make [Prometheus can reload its config whilst still running](https://prometheus.io/docs/prometheus/latest/configuration/configuration/) if you enable the `--web.enable-lifecycle` flag but I haven't figured out how to inject that into the Istio profile yet. | ||
|
|
||
| ### Azure OMS agent | ||
|
|
||
| The OMS agent pulls logs and metrics from the Kubernetes cluster and add it to a log analytics workspace. | ||
|
|
||
| This is configured by the `oms_agent` block in terraform (in the [products](https://github.com/MHRA/products) repo): | ||
|
|
||
| ```terraform | ||
| resource "azurerm_kubernetes_cluster" "cluster" { | ||
| # ...other properties... | ||
|
|
||
| addon_profile { | ||
| oms_agent { | ||
| enabled = true | ||
| log_analytics_workspace_id = azurerm_log_analytics_workspace.cluster.id | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| The configuration for the OMS agent lives [here](./oms-agent/container-azm-ms-agentconfig.yaml). | ||
|
|
||
| In this configuration we tell the OMS agent to only scrape Prometheus metrics which have the label `azure_monitor: true` by setting the scrape URLs in `prometheus-data-collection-settings` to: | ||
|
|
||
| ```yaml | ||
| urls = [ | ||
| "http://prometheus.istio-system.svc.cluster.local:9090/federate?match[]={azure_monitor=%22true%22}" | ||
| ] | ||
| ``` | ||
|
|
||
| (This uses [Prometheus federation](https://prometheus.io/docs/prometheus/latest/federation/)). | ||
|
|
||
| ### Azure Monitor Dashboard | ||
|
|
||
| The code for the dashboard lives in terraform in [modules/cluster/dashboard.tf](../modules/cluster/dashboard.tf). The JSON code for the dashboard is pretty gnarly so if you want to make changes I would recommend making them in the UI, then exporting the dashboard and JSON and pop that into terraform (and don't forget to parametrise things like the subscription id etc). | ||
|
|
||
| The queries for the Azure Monitor dashboard and written using Azure's [Kusto Query Language (KQL)](https://docs.microsoft.com/en-us/azure/data-explorer/kusto/concepts/). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| install.yaml |
4 changes: 2 additions & 2 deletions
4
kube-state-metrics/Makefile → observability/kube-state-metrics/Makefile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small point, wondering if this line is valuable. Probs won't restart prometheus pods unless there's an update. Maybe we should update the readme to do the make instead? What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This command will be used when istio has been upgraded, in which case I think this line will cause the prometheus pod to restart due to
istioctl kube-inject, which is what we want - is that right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that's true. 👍