Skip to content

Instantly share code, notes, and snippets.

@f41gh7
Created February 13, 2025 16:10
Show Gist options
  • Save f41gh7/5d9f2dbae53163bdc0ebd1ada455b8d5 to your computer and use it in GitHub Desktop.
Save f41gh7/5d9f2dbae53163bdc0ebd1ada455b8d5 to your computer and use it in GitHub Desktop.
vmagent shard UI expose
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMAgent
metadata:
name: main
spec:
selectAllByDefault: true
replicaCount: 1
statefulMode: true
shardCount: 2
extraArgs:
# http/https, replace INGRESS_HOST:INGRESS_PORT with needed values
# doc: https://docs.victoriametrics.com/vmagent/#scraping-big-number-of-targets
promscrape.cluster.memberURLTemplate: "http://INGRESS_HOST:INGRESS_PORT/vmagent/shard/%d/targets"
remoteWrite:
- url: "http://vmsingle-vms-victoria-metrics-k8s-stack.default.svc:8429/api/v1/write"
---
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMAuth
metadata:
name: expose-vmagent-ui
spec:
ingress:
# https://docs.victoriametrics.com/operator/api/#embeddedingress
host: INGRESS_DOMAIN
selectAllByDefault: false
unauthorizedUserAccessSpec:
url_map:
- src_paths: ["/vmagent/shard/0/.*"]
url_prefix: http://vmagent-main-0-0.vmagent-main.default.svc:8429
drop_src_path_prefix_parts: 3
- src_paths: ["/vmagent/shard/1/.*"]
url_prefix: http://vmagent-main-1-0.vmagent-main.default.svc:8429
drop_src_path_prefix_parts: 3
- src_paths: ["/.*"]
url_prefix:
- http://vmagent-main.default.svc:8429
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment