Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvement: add podmonitor for vpc metric collection #3061

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
3 changes: 3 additions & 0 deletions charts/aws-vpc-cni/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ spec:
- name: aws-eks-nodeagent
image: {{ include "aws-vpc-cni.nodeAgentImage" . }}
imagePullPolicy: {{ .Values.nodeAgent.image.pullPolicy }}
ports:
- containerPort: {{ .Values.nodeAgent.metricsBindAddr}}
name: agentmetrics
env:
- name: MY_NODE_NAME
valueFrom:
Expand Down
40 changes: 40 additions & 0 deletions charts/aws-vpc-cni/templates/podmonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{{- if .Values.podMonitor.create }}
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: {{ include "aws-vpc-cni.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- with .Values.podMonitor.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.podMonitor.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
jobLabel: {{ include "aws-vpc-cni.fullname" . }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
podMetricsEndpoints:
- interval: {{ .Values.podMonitor.interval }}
path: /metrics
port: metrics
{{- with .Values.podMonitor.relabelings }}
relabelings:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- if .Values.nodeAgent.enabled }}
- interval: {{ .Values.podMonitor.interval }}
path: /metrics
port: agentmetrics
{{- with .Values.podMonitor.relabelings }}
relabelings:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- end }}
selector:
matchLabels:
k8s-app: aws-node
{{- end }}
15 changes: 15 additions & 0 deletions charts/aws-vpc-cni/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ nodeAgent:
networkPolicyAgentLogFileLocation: "/var/log/aws-routed-eni/network-policy-agent.log"
enableIpv6: "false"
metricsBindAddr: "8162"
metricsBindPort: "8162"
healthProbeBindAddr: "8163"
conntrackCacheCleanupPeriod: 300
resources: {}
Expand Down Expand Up @@ -229,3 +230,17 @@ eniConfig:
# id: subnet-789
# securityGroups:
# - sg-789

podMonitor:
# Create Prometheus podMonitor
create: false
# Annotations to add to the Prometheus podMonitor
annotations: {}
# Labels to add to the Prometheus podMonitor
labels: {}
# The interval to scrape metrics.
interval: 30s
# The timeout before a metrics scrape fails.
scrapeTimeout: 30s
# relabelings to apply to the podMonitor
relabelings: []
Loading