diff --git a/examples/cni-readiness/README.md b/examples/cni-readiness/README.md index b50a2ce9..1bd0f62a 100644 --- a/examples/cni-readiness/README.md +++ b/examples/cni-readiness/README.md @@ -10,3 +10,4 @@ This example demonstrates how to use the Node Readiness Controller to ensure nod 3. The `NodeReadinessRule` (`network-readiness-rule.yaml`) instructs the controller to remove the startup taint once the `projectcalico.org/CalicoReady` condition becomes `True`. 4. The reporter is deployed with `hostNetwork: true` to reach Calico's local health endpoint. 5. The reporter needs a dedicated ServiceAccount (`cni-reporter`) with permissions to patch node status. +6. The reporter exposes Prometheus metrics on port `9445` (`/metrics`). An optional `PodMonitor` (`cni-reporter-podmonitor.yaml`) is included for prometheus-operator users and can be applied separately with `kubectl apply -f cni-reporter-podmonitor.yaml`. Since the DaemonSet runs with `hostNetwork: true`, the metrics endpoint is exposed on the host network, not just inside the cluster. \ No newline at end of file diff --git a/examples/cni-readiness/cni-reporter-ds.yaml b/examples/cni-readiness/cni-reporter-ds.yaml index 01173142..d5522fd2 100644 --- a/examples/cni-readiness/cni-reporter-ds.yaml +++ b/examples/cni-readiness/cni-reporter-ds.yaml @@ -19,6 +19,7 @@ spec: metadata: labels: app: cni-reporter + example: cni-readiness spec: hostNetwork: true serviceAccountName: cni-reporter @@ -35,6 +36,10 @@ spec: capabilities: drop: - "ALL" + ports: + - name: metrics + containerPort: 9445 + protocol: TCP env: - name: NODE_NAME valueFrom: diff --git a/examples/cni-readiness/cni-reporter-podmonitor.yaml b/examples/cni-readiness/cni-reporter-podmonitor.yaml new file mode 100644 index 00000000..f202db22 --- /dev/null +++ b/examples/cni-readiness/cni-reporter-podmonitor.yaml @@ -0,0 +1,18 @@ +# Optional: enables Prometheus Operator to scrape metrics from the CNI Reporter. +# Requires prometheus-operator and a Prometheus instance configured to watch this PodMonitor. +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + name: cni-readiness-reporter + namespace: kube-system + labels: + app: cni-reporter +spec: + selector: + matchLabels: + app: cni-reporter + example: cni-readiness + podMetricsEndpoints: + - port: metrics + path: /metrics + interval: 60s diff --git a/examples/constrained-impersonation/reporter-ds.yaml b/examples/constrained-impersonation/reporter-ds.yaml index 0d7fd881..8678687f 100644 --- a/examples/constrained-impersonation/reporter-ds.yaml +++ b/examples/constrained-impersonation/reporter-ds.yaml @@ -19,6 +19,7 @@ spec: metadata: labels: app: cni-reporter + example: constrained-impersonation spec: hostNetwork: true serviceAccountName: cni-reporter @@ -35,6 +36,10 @@ spec: capabilities: drop: - "ALL" + ports: + - name: metrics + containerPort: 9445 + protocol: TCP env: - name: NODE_NAME valueFrom: diff --git a/examples/constrained-impersonation/reporter-podmonitor.yaml b/examples/constrained-impersonation/reporter-podmonitor.yaml new file mode 100644 index 00000000..aa158478 --- /dev/null +++ b/examples/constrained-impersonation/reporter-podmonitor.yaml @@ -0,0 +1,18 @@ +# Optional: enables Prometheus Operator to scrape metrics from the Reporter. +# Requires prometheus-operator and a Prometheus instance configured to watch this PodMonitor. +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + name: constrained-impersonation-reporter + namespace: kube-system + labels: + app: cni-reporter +spec: + selector: + matchLabels: + app: cni-reporter + example: constrained-impersonation + podMetricsEndpoints: + - port: metrics + path: /metrics + interval: 60s