From f96c6654bee9b8dc0ae715420f4b7fd175d50299 Mon Sep 17 00:00:00 2001 From: Kaveesh Dubey Date: Wed, 12 Jul 2023 15:07:51 -0700 Subject: [PATCH] fix: Update init container in windows exporter so that it works on both WS2019 and WS2022 Signed-off-by: Kaveesh Dubey --- .../windows-exporter-daemonset-ws2022.yaml | 61 ------------------- kubernetes/windows-exporter-daemonset.yaml | 2 +- 2 files changed, 1 insertion(+), 62 deletions(-) delete mode 100644 kubernetes/windows-exporter-daemonset-ws2022.yaml diff --git a/kubernetes/windows-exporter-daemonset-ws2022.yaml b/kubernetes/windows-exporter-daemonset-ws2022.yaml deleted file mode 100644 index 3ef5120b..00000000 --- a/kubernetes/windows-exporter-daemonset-ws2022.yaml +++ /dev/null @@ -1,61 +0,0 @@ -apiVersion: apps/v1 -kind: DaemonSet -metadata: - labels: - app: windows-exporter - name: windows-exporter - namespace: monitoring -spec: - selector: - matchLabels: - app: windows-exporter - template: - metadata: - labels: - app: windows-exporter - spec: - securityContext: - windowsOptions: - hostProcess: true - runAsUserName: "NT AUTHORITY\\system" - hostNetwork: true - initContainers: - - name: configure-firewall - image: mcr.microsoft.com/windows/nanoserver:ltsc2022 - command: ["powershell"] - args: ["New-NetFirewallRule", "-DisplayName", "'windows-exporter'", "-Direction", "inbound", "-Profile", "Any", "-Action", "Allow", "-LocalPort", "9182", "-Protocol", "TCP"] - containers: - - args: - - --config.file=%CONTAINER_SANDBOX_MOUNT_POINT%/config.yml - name: windows-exporter - image: ghcr.io/prometheus-community/windows-exporter:latest - imagePullPolicy: Always - ports: - - containerPort: 9182 - hostPort: 9182 - name: http - volumeMounts: - - name: windows-exporter-config - mountPath: /config.yml - subPath: config.yml - nodeSelector: - kubernetes.io/os: windows - volumes: - - name: windows-exporter-config - configMap: - name: windows-exporter-config ---- -kind: ConfigMap -apiVersion: v1 -metadata: - name: windows-exporter-config - namespace: monitoring - labels: - app: windows-exporter -data: - config.yml: | - collectors: - enabled: '[defaults],container' - collector: - service: - services-where: "Name='containerd' or Name='kubelet'" diff --git a/kubernetes/windows-exporter-daemonset.yaml b/kubernetes/windows-exporter-daemonset.yaml index a87a09f7..13ec3eee 100644 --- a/kubernetes/windows-exporter-daemonset.yaml +++ b/kubernetes/windows-exporter-daemonset.yaml @@ -21,7 +21,7 @@ spec: hostNetwork: true initContainers: - name: configure-firewall - image: mcr.microsoft.com/windows/nanoserver:1809 + image: mcr.microsoft.com/powershell:lts-nanoserver-1809 command: ["powershell"] args: ["New-NetFirewallRule", "-DisplayName", "'windows-exporter'", "-Direction", "inbound", "-Profile", "Any", "-Action", "Allow", "-LocalPort", "9182", "-Protocol", "TCP"] containers: