Skip to content

Commit

Permalink
cluster: use autodiscovered nodes, allow setting external nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewChubatiuk committed Sep 14, 2024
1 parent 3246850 commit ffbfc87
Show file tree
Hide file tree
Showing 29 changed files with 904 additions and 674 deletions.
4 changes: 3 additions & 1 deletion charts/victoria-metrics-cluster/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

## Next release

- TODO
- Support extra storageNodes. Fail if no storageNodes set
- Replace storageNode list for enterprise with autodiscovered storage nodes
- Added HPA with scaledown disabled by default

## 0.13.7

Expand Down
96 changes: 96 additions & 0 deletions charts/victoria-metrics-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,15 @@ enabled: false
<td><p>Service ClusterIP</p>
</td>
</tr>
<tr>
<td>vminsert.service.enabled</td>
<td>bool</td>
<td><pre lang="">
true
</pre>
</td>
<td></td>
</tr>
<tr>
<td>vminsert.service.externalIPs</td>
<td>list</td>
Expand Down Expand Up @@ -1589,6 +1598,15 @@ enabled: true
<td><p>Service ClusterIP</p>
</td>
</tr>
<tr>
<td>vmselect.service.enabled</td>
<td>bool</td>
<td><pre lang="">
true
</pre>
</td>
<td></td>
</tr>
<tr>
<td>vmselect.service.externalIPs</td>
<td>list</td>
Expand Down Expand Up @@ -2003,6 +2021,57 @@ null
</pre>
</td>
<td><p>Overrides the full name of vmstorage component</p>
</td>
</tr>
<tr>
<td>vmstorage.horizontalPodAutoscaler.behavior</td>
<td>object</td>
<td><pre lang="plaintext">
scaleDown:
selectPolicy: Disabled
</pre>
</td>
<td><p>Behavior settings for scaling by the HPA</p>
</td>
</tr>
<tr>
<td>vmstorage.horizontalPodAutoscaler.enabled</td>
<td>bool</td>
<td><pre lang="">
false
</pre>
</td>
<td><p>Use HPA for vmstorage component</p>
</td>
</tr>
<tr>
<td>vmstorage.horizontalPodAutoscaler.maxReplicas</td>
<td>int</td>
<td><pre lang="">
10
</pre>
</td>
<td><p>Maximum replicas for HPA to use to to scale the vmstorage component</p>
</td>
</tr>
<tr>
<td>vmstorage.horizontalPodAutoscaler.metrics</td>
<td>list</td>
<td><pre lang="plaintext">
[]
</pre>
</td>
<td><p>Metric for HPA to use to scale the vmstorage component</p>
</td>
</tr>
<tr>
<td>vmstorage.horizontalPodAutoscaler.minReplicas</td>
<td>int</td>
<td><pre lang="">
2
</pre>
</td>
<td><p>Minimum replicas for HPA to use to scale the vmstorage component</p>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -2338,6 +2407,24 @@ enabled: false
<td><p>Service annotations</p>
</td>
</tr>
<tr>
<td>vmstorage.service.clusterIP</td>
<td>string</td>
<td><pre lang="">
None
</pre>
</td>
<td></td>
</tr>
<tr>
<td>vmstorage.service.enabled</td>
<td>bool</td>
<td><pre lang="">
true
</pre>
</td>
<td></td>
</tr>
<tr>
<td>vmstorage.service.externalTrafficPolicy</td>
<td>string</td>
Expand Down Expand Up @@ -2404,6 +2491,15 @@ enabled: false
<td><p>Service port</p>
</td>
</tr>
<tr>
<td>vmstorage.service.type</td>
<td>string</td>
<td><pre lang="">
ClusterIP
</pre>
</td>
<td></td>
</tr>
<tr>
<td>vmstorage.service.vminsertPort</td>
<td>int</td>
Expand Down
23 changes: 13 additions & 10 deletions charts/victoria-metrics-cluster/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
{{ if .Values.printNotes }}
{{- $ctx := dict "helm" . "style" "plain" }}
{{ if .Values.vminsert.enabled }}
{{- $_ := set $ctx "appKey" "vminsert" }}
Write API:

The Victoria Metrics write api can be accessed via port {{ .Values.vminsert.service.servicePort }} with the following DNS name from within your cluster:
{{ include "victoria-metrics.vminsert.fullname" . }}.{{ include "vm.namespace" . }}.svc.{{ .Values.clusterDomainSuffix }}
{{ include "vm.fqdn" $ctx }}

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 {{ include "vm.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "victoria-metrics.vminsert.fullname" . }})
export NODE_PORT=$(kubectl get --namespace {{ include "vm.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "vm.service" $ctx }})
export NODE_IP=$(kubectl get nodes --namespace {{ include "vm.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 {{ include "vm.namespace" . }} -w {{ include "victoria-metrics.vminsert.fullname" . }}'
You can watch the status of by running 'kubectl get svc --namespace {{ include "vm.namespace" . }} -w {{ include "vm.service" $ctx }}'

export SERVICE_IP=$(kubectl get svc --namespace {{ include "vm.namespace" . }} {{ include "victoria-metrics.vminsert.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
export SERVICE_IP=$(kubectl get svc --namespace {{ include "vm.namespace" . }} {{ include "vm.service" $ctx }} -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 {{ include "vm.namespace" . }} -l "app={{ .Values.vminsert.name }}" -o jsonpath="{.items[0].metadata.name}")
Expand All @@ -33,26 +35,27 @@ prometheus.yml
for example - inside the Kubernetes cluster:

remote_write:
- url: "http://{{ include "victoria-metrics.vminsert.fullname" . }}.{{ include "vm.namespace" . }}.svc.{{ .Values.clusterDomainSuffix }}:{{ .Values.vminsert.service.servicePort }}/insert/0/prometheus/"
- url: "http://{{ include "vm.fqdn" $ctx }}:{{ .Values.vminsert.service.servicePort }}/insert/0/prometheus/"

{{- end }}

{{- if .Values.vmselect.enabled }}
{{- $_ := set $ctx "appKey" "vmselect" }}
Read API:

The VictoriaMetrics read api can be accessed via port {{ .Values.vmselect.service.servicePort }} with the following DNS name from within your cluster:
{{ include "victoria-metrics.vmselect.fullname" . }}.{{ include "vm.namespace" . }}.svc.{{ .Values.clusterDomainSuffix }}
{{ include "vm.fqdn" $ctx }}

Get the VictoriaMetrics select service URL by running these commands in the same shell:
{{- if contains "NodePort" .Values.vmselect.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ include "vm.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "victoria-metrics.vminsert.fullname" . }})
export NODE_PORT=$(kubectl get --namespace {{ include "vm.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "vm.service" $ctx }})
export NODE_IP=$(kubectl get nodes --namespace {{ include "vm.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 {{ include "vm.namespace" . }} -w {{ include "victoria-metrics.vminsert.fullname" . }}'
You can watch the status of by running 'kubectl get svc --namespace {{ include "vm.namespace" . }} -w {{ include "vm.service" $ctx }}'

export SERVICE_IP=$(kubectl get svc --namespace {{ include "vm.namespace" . }} {{ include "victoria-metrics.vmselect.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
export SERVICE_IP=$(kubectl get svc --namespace {{ include "vm.namespace" . }} {{ include "vm.service" $ctx }} -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 {{ include "vm.namespace" . }} -l "app={{ .Values.vmselect.name }}" -o jsonpath="{.items[0].metadata.name}")
Expand All @@ -69,7 +72,7 @@ Input this URL field into Grafana

for example - inside the Kubernetes cluster:

http://{{ include "victoria-metrics.vmselect.fullname" . }}.{{ include "vm.namespace" . }}.svc.{{ .Values.clusterDomainSuffix }}:{{ .Values.vmselect.service.servicePort }}/select/0/prometheus/
http://{{ include "vm.fqdn" $ctx }}:{{ .Values.vmselect.service.servicePort }}/select/0/prometheus/

{{- end }}
{{- end }}
Expand Down
Loading

0 comments on commit ffbfc87

Please sign in to comment.