mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-01 14:47:38 +00:00
76 lines
4.2 KiB
Text
76 lines
4.2 KiB
Text
{{ if .Values.vminsert.enabled }}
|
|
Write API:
|
|
|
|
The Victoria Metrics write api can be accessed via port {{ .Values.vminsert.service.servicePort }} on the following DNS name from within your cluster:
|
|
{{ template "victoria-metrics.vminsert.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomainSuffix }}
|
|
|
|
Get the Victoria Metrics insert service URL by running these commands in the same shell:
|
|
{{- if contains "NodePort" .Values.vminsert.service.type }}
|
|
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "victoria-metrics.vminsert.fullname" . }})
|
|
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
|
echo http://$NODE_IP:$NODE_PORT
|
|
{{- else if contains "LoadBalancer" .Values.vminsert.service.type }}
|
|
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
|
You can watch the status of by running 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "victoria-metrics.vminsert.fullname" . }}'
|
|
|
|
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "victoria-metrics.vminsert.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
|
echo http://$SERVICE_IP:{{ .Values.vminsert.service.servicePort }}
|
|
{{- else if contains "ClusterIP" .Values.vminsert.service.type }}
|
|
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ .Values.vminsert.name }}" -o jsonpath="{.items[0].metadata.name}")
|
|
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME {{ .Values.vminsert.service.servicePort }}
|
|
{{- end }}
|
|
|
|
You need to update your prometheus configuration file and add next lines into it:
|
|
|
|
prometheus.yml
|
|
```yaml
|
|
remote_write:
|
|
- url: "http://<insert-service>/insert/0/prometheus/"
|
|
|
|
```
|
|
|
|
for e.g. inside the kubernetes cluster:
|
|
```yaml
|
|
remote_write:
|
|
- url: "http://{{ template "victoria-metrics.vminsert.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomainSuffix }}:{{ .Values.vminsert.service.servicePort }}/insert/0/prometheus/"
|
|
|
|
```
|
|
{{- end }}
|
|
|
|
{{- if .Values.vmselect.enabled }}
|
|
Read API:
|
|
|
|
The Victoria Metrics read api can be accessed via port {{ .Values.vmselect.service.servicePort }} on the following DNS name from within your cluster:
|
|
{{ template "victoria-metrics.vmselect.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomainSuffix }}
|
|
|
|
Get the Victoria Metrics select service URL by running these commands in the same shell:
|
|
{{- if contains "NodePort" .Values.vmselect.service.type }}
|
|
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "victoria-metrics.vminsert.fullname" . }})
|
|
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
|
echo http://$NODE_IP:$NODE_PORT
|
|
{{- else if contains "LoadBalancer" .Values.vmselect.service.type }}
|
|
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
|
You can watch the status of by running 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "victoria-metrics.vminsert.fullname" . }}'
|
|
|
|
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "victoria-metrics.vmselect.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
|
echo http://$SERVICE_IP:{{ .Values.vmselect.service.servicePort }}
|
|
{{- else if contains "ClusterIP" .Values.vmselect.service.type }}
|
|
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ .Values.vmselect.name }}" -o jsonpath="{.items[0].metadata.name}")
|
|
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME {{ .Values.vmselect.service.servicePort }}
|
|
{{- end }}
|
|
|
|
You need to update specify select service URL in your Grafana:
|
|
NOTE: you need to use Prometheus Data Source
|
|
|
|
Input for URL field in Grafana
|
|
|
|
```
|
|
http://<select-service>/select/0/prometheus/
|
|
```
|
|
|
|
for e.g. inside the kubernetes cluster:
|
|
```
|
|
http://{{ template "victoria-metrics.vmselect.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomainSuffix }}:{{ .Values.vmselect.service.servicePort }}/select/0/prometheus/"
|
|
```
|
|
{{- end }}
|
|
|