129 lines
4.4 KiB
YAML
129 lines
4.4 KiB
YAML
{{- if .Values.metricHelm }}
|
|
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata: { name: "{{ .Values.metric }}-node-exporter", namespace: "{{ .Values.namespace }}" }
|
|
spec:
|
|
selector: { app: "{{ .Values.metric }}-node-exporter" }
|
|
ports: [ { name: metrics, protocol: TCP, port: 9100, targetPort: 9100 } ]
|
|
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: DaemonSet
|
|
metadata: { name: "{{ .Values.metric }}-node-exporter", namespace: "{{ .Values.namespace }}" }
|
|
spec:
|
|
selector:
|
|
matchLabels: { app: "{{ .Values.metric }}-node-exporter" }
|
|
template:
|
|
metadata:
|
|
labels: { app: "{{ .Values.metric }}-node-exporter" }
|
|
spec:
|
|
hostNetwork: true
|
|
hostPID: true
|
|
dnsPolicy: ClusterFirstWithHostNet
|
|
tolerations:
|
|
- operator: "Exists"
|
|
containers:
|
|
- name: "{{ .Values.metric }}-node-exporter"
|
|
image: quay.io/prometheus/node-exporter:v1.8.2
|
|
args:
|
|
- --web.listen-address=:9100
|
|
- --path.procfs=/host/proc
|
|
- --path.sysfs=/host/sys
|
|
- --path.rootfs=/host/root
|
|
- --collector.textfile.directory={{ .Values.metricPromPath }}
|
|
ports: [ { containerPort: 9100, hostPort: 9100, name: metrics } ]
|
|
resources:
|
|
requests: { cpu: "10m", memory: "32Mi" }
|
|
limits: { cpu: "150m", memory: "200Mi" }
|
|
securityContext:
|
|
readOnlyRootFilesystem: true
|
|
allowPrivilegeEscalation: false
|
|
volumeMounts:
|
|
- { name: proc, mountPath: /host/proc, readOnly: true }
|
|
- { name: sys, mountPath: /host/sys, readOnly: true }
|
|
- { name: root, mountPath: /host/root, readOnly: true }
|
|
- { name: textfile, mountPath: "{{ .Values.metricPromPath }}", readOnly: true }
|
|
volumes:
|
|
- name: proc
|
|
hostPath: { path: /proc, type: Directory }
|
|
- name: sys
|
|
hostPath: { path: /sys, type: Directory }
|
|
- name: root
|
|
hostPath: { path: /, type: Directory }
|
|
- name: textfile
|
|
hostPath: { path: "{{ .Values.metricPromPath }}", type: DirectoryOrCreate }
|
|
|
|
---
|
|
apiVersion: v1
|
|
kind: ServiceAccount
|
|
metadata: { name: "{{ .Values.metric }}-vmagent", namespace: "{{ .Values.namespace }}" }
|
|
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: ClusterRole
|
|
metadata: { name: "{{ .Values.metric }}-vmagent" }
|
|
rules:
|
|
- apiGroups: [""]
|
|
resources: ["nodes", "nodes/proxy", "services", "endpoints", "pods"]
|
|
verbs: ["get", "list", "watch"]
|
|
- apiGroups: ["discovery.k8s.io"]
|
|
resources: ["endpointslices"]
|
|
verbs: ["get", "list", "watch"]
|
|
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: ClusterRoleBinding
|
|
metadata: { name: "{{ .Values.metric }}-vmagent" }
|
|
roleRef:
|
|
apiGroup: rbac.authorization.k8s.io
|
|
kind: ClusterRole
|
|
name: "{{ .Values.metric }}-vmagent"
|
|
subjects:
|
|
- kind: ServiceAccount
|
|
name: "{{ .Values.metric }}-vmagent"
|
|
namespace: "{{ .Values.namespace }}"
|
|
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata: { name: "{{ .Values.metric }}-vmagent", namespace: "{{ .Values.namespace }}" }
|
|
spec:
|
|
selector: { app: "{{ .Values.metric }}-vmagent" }
|
|
ports: [ { name: http, protocol: TCP, port: 8429, targetPort: 8429 } ]
|
|
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata: { name: "{{ .Values.metric }}-vmagent", namespace: "{{ .Values.namespace }}" }
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels: { app: "{{ .Values.metric }}-vmagent" }
|
|
template:
|
|
metadata:
|
|
labels: { app: "{{ .Values.metric }}-vmagent" }
|
|
spec:
|
|
serviceAccountName: "{{ .Values.metric }}-vmagent"
|
|
containers:
|
|
- name: "{{ .Values.metric }}-vmagent"
|
|
image: victoriametrics/vmagent:v1.112.0
|
|
args:
|
|
- -promscrape.config=/etc/vmagent/vmagent.yml
|
|
- -httpListenAddr=:8429
|
|
- -loggerLevel=INFO
|
|
- -remoteWrite.url={{ .Values.metricApiUrl }}
|
|
- -remoteWrite.label=server={{ .Values.namespace }}
|
|
ports: [ { containerPort: 8429, name: http } ]
|
|
resources:
|
|
requests: { cpu: "30m", memory: "128Mi" }
|
|
limits: { cpu: "300m", memory: "512Mi" }
|
|
volumeMounts:
|
|
- { name: "{{ .Values.metric }}-vmagent-config-volume", mountPath: /etc/vmagent/vmagent.yml, subPath: vmagent.yml, readOnly: true }
|
|
volumes:
|
|
- name: "{{ .Values.metric }}-vmagent-config-volume"
|
|
hostPath: { path: "{{ .Values.metricVmagentPath }}", type: DirectoryOrCreate }
|
|
|
|
{{- end }}
|