Kubernetes Windows node exporter
here is an example of working node exporter for windows server in kubernetes
apiVersion: apps/v1
kind: DaemonSet
metadata:
labels:
app: windows-exporter
name: windows-exporter
# namespace: dev
spec:
selector:
matchLabels:
app: windows-exporter
template:
metadata:
labels:
app: windows-exporter
spec:
nodeSelector:
kubernetes.io/os: windows
securityContext:
windowsOptions:
hostProcess: true
runAsUserName: "NT AUTHORITY\\system"
hostNetwork: true
containers:
- name: windows-exporter
image: ghcr.io/prometheus-community/windows-exporter:latest
imagePullPolicy: Always
args:
- --config.file=%CONTAINER_SANDBOX_MOUNT_POINT%/config.yml
ports:
- containerPort: 9182
volumeMounts:
- name: windows-exporter
mountPath: /config.yml
subPath: config.yml
volumes:
- name: windows-exporter
configMap:
name: windows-exporter
---
kind: ConfigMap
apiVersion: v1
metadata:
name: windows-exporter
namespace: dev
labels:
app: windows-exporter
data:
config.yml: |
collectors:
enabled: 'cpu,cs,container,logical_disk,net,os,service,system'
collector:
service:
services-where: "Name='containerd' or Name='kubelet'"
note that metrics will have only containerd identifier, you can join them with container info metric
kube_pod_container_info{container="my-app", container_id=~"containerd://.+"}
Links
- https://github.com/prometheus-community/windows_exporter
- https://github.com/prometheus-community/windows_exporter/blob/master/kubernetes/kubernetes.md
- https://github.com/prometheus-community/windows_exporter/blob/master/README.md#using-a-configuration-file
- https://github.com/prometheus-community/windows_exporter/blob/master/kubernetes/windows-exporter-daemonset.yaml