docs: update formatiing for k8s monitoring with Managed VictoriaMetrics (#3768)

* jekyll formatting madness
This commit is contained in:
Max Golionko 2023-02-06 05:33:40 -05:00 committed by Aliaksandr Valialkin
parent 80bf0bcf8c
commit eaa3716507
No known key found for this signature in database
GPG Key ID: A72BEC6CD3D0DED1

View File

@ -7,122 +7,121 @@ For node resource utilization we will be collecting metrics from `node-exporter`
For workloads monitoring in kubernetes cluster we will have [VictoriaMetrics Operator](https://docs.victoriametrics.com/operator/VictoriaMetrics-Operator.html). It enables us to define scrape jobs using kubernetes CRDs [VMServiceScrape](https://docs.victoriametrics.com/operator/design.html#vmservicescrape), [VMPodScrape](https://docs.victoriametrics.com/operator/design.html#vmpodscrape). To add alerts or recording rules for workloads we can use [VMRule](https://docs.victoriametrics.com/operator/design.html#vmrule) CRD For workloads monitoring in kubernetes cluster we will have [VictoriaMetrics Operator](https://docs.victoriametrics.com/operator/VictoriaMetrics-Operator.html). It enables us to define scrape jobs using kubernetes CRDs [VMServiceScrape](https://docs.victoriametrics.com/operator/design.html#vmservicescrape), [VMPodScrape](https://docs.victoriametrics.com/operator/design.html#vmpodscrape). To add alerts or recording rules for workloads we can use [VMRule](https://docs.victoriametrics.com/operator/design.html#vmrule) CRD
## Installation ## Overview
In this guide we will be using [victoria-metrics-k8s-stack](https://github.com/VictoriaMetrics/helm-charts/tree/master/charts/victoria-metrics-k8s-stack) helm chart In this guide we will be using [victoria-metrics-k8s-stack](https://github.com/VictoriaMetrics/helm-charts/tree/master/charts/victoria-metrics-k8s-stack) helm chart
This chart will install `VMOperator`, `VMAgent`, `NodeExporter`, `kube-state-metrics`, `grafana` and some service scrape configurations to start monitoring kuberentes cluster components This chart will install `VMOperator`, `VMAgent`, `NodeExporter`, `kube-state-metrics`, `grafana` and some service scrape configurations to start monitoring kuberentes cluster components
### Prerequisites ## Prerequisites
- Active Managed VictoriaMetrics instance. You can learn how to signup for Managed VictoriaMetrics [here](https://docs.victoriametrics.com/managed-victoriametrics/quickstart.html#how-to-register). - Active Managed VictoriaMetrics instance. You can learn how to signup for Managed VictoriaMetrics [here](https://docs.victoriametrics.com/managed-victoriametrics/quickstart.html#how-to-register).
- Access to your kubernetes cluster - Access to your kubernetes cluster
- Helm binary. You can find installation [here]https://helm.sh/docs/intro/install/() - Helm binary. You can find installation [here](https://helm.sh/docs/intro/install/)
### Installation steps ## Installation steps
Install the Helm chart in a custom namespace Install the Helm chart in a custom namespace
1. Create a unique Kubernetes namespace, for example `monitoring`
1. Create a unique Kubernetes namespace, for example monitoring <div class="with-copy" markdown="1">
``` ```bash
kubectl create namespace monitoring kubectl create namespace monitoring
``` ```
</div>
2. Create kubernetes-secrets with token to access your dbaas deployment 2. Create kubernetes-secrets with token to access your dbaas deployment
<div class="with-copy" markdown="1">
``` ```bash
kubectl --namespace monitoring create secret generic dbaas-write-access-token --from-literal=bearerToken=your-token kubectl --namespace monitoring create secret generic dbaas-write-access-token --from-literal=bearerToken=your-token
kubectl --namespace monitoring create secret generic dbaas-read-access-token --from-literal=bearerToken=your-token
kubectl --namespace monitoring create secret generic dbaas-read-access-token --from-literal=bearerToken=your-token ```
``` </div>
You can find your access token on the "Access" tab of your deployment
> You can find your access token on the "Access" tab of your deployment <img src="how-to-monitor-k8s_access-token.png" width="800">
<p>
<img src="how-to-monitor-k8s_access-token.png" width="800">
</p>
3. Set up a Helm repository using the following commands: 3. Set up a Helm repository using the following commands:
``` <div class="with-copy" markdown="1">
helm repo add grafana https://grafana.github.io/helm-charts ```bash
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts helm repo add grafana https://grafana.github.io/helm-charts
helm repo add vm https://victoriametrics.github.io/helm-charts helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update helm repo add vm https://victoriametrics.github.io/helm-charts
``` helm repo update
```
</div>
4. Create a YAML file of Helm values called dbaas.yaml with following content 4. Create a YAML file of Helm values called dbaas.yaml with following content
```yaml <div class="with-copy" markdown="1">
externalVM: ```yaml
read: externalVM:
url: read:
bearerTokenSecret: url: <reading url, you can find it in examples on Access page>
name: dbaas-write-access-token bearerTokenSecret:
key: bearerToken name: dbaas-write-access-token
write: key: bearerToken
url: write:
bearerTokenSecret: url: <reading url, you can find it in examples on Access page>
name: dbaas-read-access-token bearerTokenSecret:
key: bearerToken name: dbaas-read-access-token
key: bearerToken
vmsingle: vmsingle:
enabled: false enabled: false
vmcluster: vmcluster:
enabled: false enabled: false
vmalert: vmalert:
enabled: true enabled: true
spec: spec:
evaluationInterval: 15s evaluationInterval: 15s
vmagent: vmagent:
enabled: true enabled: true
spec: spec:
scrapeInterval: 30s scrapeInterval: 30s
externalLabels: externalLabels:
cluster: cluster-name cluster: <your cluster name>
# dependencies
# Grafana dependency chart configuration. For possible values refer to https://github.com/grafana/helm-charts/tree/main/charts/grafana#configuration
grafana:
enabled: true
```
# dependencies
# Grafana dependency chart configuration. For possible values refer to https://github.com/grafana/helm-charts/tree/main/charts/grafana#configuration
grafana:
enabled: true
```
</div>
5. Install VictoriaMetrics-k8s-stack helm chart 5. Install VictoriaMetrics-k8s-stack helm chart
<div class="with-copy" markdown="1">
```bash
helm --namespace monitoring install vm vm/victoria-metrics-k8s-stack -f dbaas.yaml -n monitoring
```
</div>
``` ## Connect grafana
helm --namespace monitoring install vm vm/victoria-metrics-k8s-stack -f dbaas.yaml -n monitoring
```
### Connect to grafana and create your datasource Connect to grafana and create your datasource
> If you are using external grafana, you can skip steps 1-3 and you will need to import dashboards that can be found here manually > If you are using external grafana, you can skip steps 1-3 and you will need to import dashboards that can be found here manually
1. Get grafana password 1. Get grafana password
``` <div class="with-copy" markdown="1">
kubectl --namespace monitoring get secret vm-grafana -o jsonpath="{.data.admin-password}" | base64 -d ```bash
``` kubectl --namespace monitoring get secret vm-grafana -o jsonpath="{.data.admin-password}" | base64 -d
```
</div>
2. Connect to grafana 2. Connect to grafana
``` <div class="with-copy" markdown="1">
kubectl --namespace monitoring port-forward service/vm-grafana 3000:80 ```bash
``` kubectl --namespace monitoring port-forward service/vm-grafana 3000:80
3. Open grafana in your browser http://localhost:3000/datasources ```
</div>
3. Open grafana in your browser [http://localhost:3000/datasources](http://localhost:3000/datasources)
Use admin as username and password from previous step Use admin as username and password from previous step
4. Click on add datasource 4. Click on add datasource
Choose VictoriaMetrics or Prometheus as datasource type. Make sure you made this datasource as default for dashboards to work. Choose VictoriaMetrics or Prometheus as datasource type. Make sure you made this datasource as default for dashboards to work.
> You can find token and URL in your deployment, on Access tab
<img src="how-to-monitor-k8s_datasource.png" width="800">
<p> ## Test it
<img src="how-to-monitor-k8s_datasource.png" width="800">
</p>
> You can find token and URL in your deployment, on access tab - You should be able to see data that was sent to your dbaas using VMAgent dashboard [http://localhost:3000/d/G7Z9GzMGz/victoriametrics-vmagent/](http://localhost:3000/d/G7Z9GzMGz/victoriametrics-vmagent/)
- You also will be able to see bunch of kuberentes dashboards in your grafana
### Test it
You should be able to see data that was sent to your dbaas using VMAgent dashboard http://localhost:3000/d/G7Z9GzMGz/victoriametrics-vmagent/
You also will be able to see bunch of kuberentes dashboards in your grafana