Skip to content

Commit a55dc24

Browse files
committed
chore(victoriametrics): add drycc controller metrics
1 parent c3da144 commit a55dc24

3 files changed

Lines changed: 39 additions & 58 deletions

File tree

charts/victoriametrics/templates/victoriametrics/networkpolicy.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: networking.k8s.io/v1
22
kind: NetworkPolicy
33
metadata:
4-
name: drycc-victoriametrics-networkpolicy
4+
name: drycc-victoriametrics
55
spec:
66
podSelector:
77
matchLabels:
@@ -13,4 +13,13 @@ spec:
1313
- namespaceSelector:
1414
matchLabels:
1515
kubernetes.io/metadata.name: {{.Release.Namespace}}
16-
podSelector: {}
16+
podSelector:
17+
matchLabels:
18+
app: drycc-controller-api
19+
- from:
20+
- namespaceSelector:
21+
matchLabels:
22+
kubernetes.io/metadata.name: {{.Release.Namespace}}
23+
podSelector:
24+
matchLabels:
25+
app: drycc-victoriametrics

charts/victoriametrics/templates/victoriametrics/vmagent/vmagent-configmap.yaml

Lines changed: 24 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -11,41 +11,44 @@ data:
1111
{{- (tpl .Values.vmagent.prometheus $) | nindent 4 }}
1212
{{- else }}
1313
global:
14-
## How frequently to scrape targets by default
15-
##
1614
scrape_interval: 1m
17-
## How long until a scrape request times out
18-
##
1915
scrape_timeout: 10s
2016
scrape_configs:
2117
- job_name: vmagent
2218
static_configs:
2319
- targets: ["localhost:8429"]
20+
- job_name: "controller-nodes"
21+
scheme: http
22+
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
23+
kubernetes_sd_configs:
24+
- role: node
25+
relabel_configs:
26+
- target_label: __address__
27+
replacement: drycc-controller-api.{{.Release.Namespace}}.svc.{{.Values.global.clusterDomain}}:80
28+
- source_labels: [__meta_kubernetes_node_name]
29+
regex: (.+)
30+
target_label: __metrics_path__
31+
replacement: /v2/nodes/$1/proxy/metrics
32+
- job_name: "controller-nodes-cadvisor"
33+
scheme: http
34+
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
35+
kubernetes_sd_configs:
36+
- role: node
37+
relabel_configs:
38+
- target_label: __address__
39+
replacement: drycc-controller-api.{{.Release.Namespace}}.svc.{{.Values.global.clusterDomain}}:80
40+
- source_labels: [__meta_kubernetes_node_name]
41+
regex: (.+)
42+
target_label: __metrics_path__
43+
replacement: /v2/nodes/$1/proxy/metrics/cadvisor
2444
- job_name: "kubernetes-apiservers"
2545
kubernetes_sd_configs:
2646
- role: endpoints
27-
# Default to scraping over https. If required, just disable this or change to
28-
# `http`.
2947
scheme: https
30-
# This TLS & bearer token file config is used to connect to the actual scrape
31-
# endpoints for cluster components. This is separate to discovery auth
32-
# configuration because discovery & scraping are two separate concerns in
33-
# Prometheus. The discovery auth config is automatic if Prometheus runs inside
34-
# the cluster. Otherwise, more config options have to be provided within the
35-
# <kubernetes_sd_config>.
3648
tls_config:
3749
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
38-
# If your node certificates are self-signed or use a different CA to the
39-
# master CA, then you need to disable certificate verification. Note that
40-
# certificate verification is an integral part of a secure infrastructure
41-
# so this should only be disabled in a controlled environment. You can
42-
# enable certificate verification by commenting the line below.
43-
#
4450
insecure_skip_verify: true
4551
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
46-
# Keep only the default/kubernetes service endpoints for the https port. This
47-
# will add targets for each API server which Kubernetes adds an endpoint to
48-
# the default/kubernetes service.
4952
relabel_configs:
5053
- source_labels:
5154
[
@@ -56,23 +59,9 @@ data:
5659
action: keep
5760
regex: default;kubernetes;https
5861
- job_name: "kubernetes-nodes"
59-
# Default to scraping over https. If required, just disable this or change to
60-
# `http`.
6162
scheme: https
62-
# This TLS & bearer token file config is used to connect to the actual scrape
63-
# endpoints for cluster components. This is separate to discovery auth
64-
# configuration because discovery & scraping are two separate concerns in
65-
# Prometheus. The discovery auth config is automatic if Prometheus runs inside
66-
# the cluster. Otherwise, more config options have to be provided within the
67-
# <kubernetes_sd_config>.
6863
tls_config:
6964
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
70-
# If your node certificates are self-signed or use a different CA to the
71-
# master CA, then you need to disable certificate verification. Note that
72-
# certificate verification is an integral part of a secure infrastructure
73-
# so this should only be disabled in a controlled environment. You can
74-
# enable certificate verification by commenting the line below.
75-
#
7665
insecure_skip_verify: true
7766
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
7867
kubernetes_sd_configs:
@@ -87,32 +76,13 @@ data:
8776
target_label: __metrics_path__
8877
replacement: /api/v1/nodes/$1/proxy/metrics
8978
- job_name: "kubernetes-nodes-cadvisor"
90-
# Default to scraping over https. If required, just disable this or change to
91-
# `http`.
9279
scheme: https
93-
# This TLS & bearer token file config is used to connect to the actual scrape
94-
# endpoints for cluster components. This is separate to discovery auth
95-
# configuration because discovery & scraping are two separate concerns in
96-
# Prometheus. The discovery auth config is automatic if Prometheus runs inside
97-
# the cluster. Otherwise, more config options have to be provided within the
98-
# <kubernetes_sd_config>.
9980
tls_config:
10081
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
101-
# If your node certificates are self-signed or use a different CA to the
102-
# master CA, then disable certificate verification below. Note that
103-
# certificate verification is an integral part of a secure infrastructure
104-
# so this should only be disabled in a controlled environment. You can
105-
# disable certificate verification by uncommenting the line below.
106-
#
10782
insecure_skip_verify: true
10883
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
10984
kubernetes_sd_configs:
11085
- role: node
111-
# This configuration will work only on kubelet 1.7.3+
112-
# As the scrape endpoints for cAdvisor have changed
113-
# if you are using older version you need to change the replacement to
114-
# replacement: /api/v1/nodes/$1:4194/proxy/metrics
115-
# more info here https://github.com/coreos/prometheus-operator/issues/633
11686
relabel_configs:
11787
- action: labelmap
11888
regex: __meta_kubernetes_node_label_(.+)

charts/victoriametrics/templates/victoriametrics/vmagent/vmagent-statefulset.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ spec:
2424
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.vmagent.nodeAffinityPreset.type "key" .Values.vmagent.nodeAffinityPreset.key "values" .Values.vmagent.nodeAffinityPreset.values ) | nindent 10 }}
2525
serviceAccount: drycc-victoriametrics-vmagent
2626
initContainers:
27-
- name: drycc-victoriametrics-vmstorage-init
27+
- name: drycc-victoriametrics-vmagent-init
2828
image: {{.Values.imageRegistry}}/{{.Values.imageOrg}}/python-dev:latest
2929
imagePullPolicy: {{.Values.imagePullPolicy}}
3030
args:
3131
- netcat
3232
- -v
3333
- -a
34+
- $(DRYCC_CONTROLLER_API_SERVICE_HOST):$(DRYCC_CONTROLLER_API_SERVICE_PORT)
35+
- -a
3436
- {{ printf "drycc-victoriametrics-vminsert.%s.svc.%s:8480" $.Release.Namespace $.Values.global.clusterDomain }}
3537
containers:
3638
- name: drycc-victoriametrics-vmagent
@@ -42,7 +44,7 @@ spec:
4244
{{- else }}
4345
args:
4446
- vmagent
45-
- --remoteWrite.url={{ printf "http://drycc-victoriametrics-vminsert.%s.svc.%s:8480/insert/0/prometheus/api/v1/write" $.Release.Namespace $.Values.global.clusterDomain }}
47+
- --remoteWrite.url={{ printf "http://drycc-victoriametrics-vminsert.%s.svc.%s:8480/insert/multitenant/prometheus/api/v1/write" $.Release.Namespace $.Values.global.clusterDomain }}
4648
- --remoteWrite.tmpDataPath=/data
4749
- --httpListenAddr=:8429
4850
- --promscrape.config=/opt/drycc/victoriametrics/config/prometheus.yaml

0 commit comments

Comments
 (0)