Skip to content

Instantly share code, notes, and snippets.

@mikejoh
Last active May 15, 2025 19:58
Show Gist options
  • Save mikejoh/e54b8f29d78ead9d1e9e35353e9050f0 to your computer and use it in GitHub Desktop.
Save mikejoh/e54b8f29d78ead9d1e9e35353e9050f0 to your computer and use it in GitHub Desktop.

Revisions

  1. mikejoh revised this gist Feb 25, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion monitor-calico-felix-using-prom-op-in-k8s.md
    Original file line number Diff line number Diff line change
    @@ -49,7 +49,7 @@ spec:
    targetLabel: instance
    ```

    _Note the relabeling added to have a more descritive `instance` label of the scraped Calico Felix metrics._
    _Note the relabeling above, this changes the `instance` label to something more descriptive when querying for Calico Felix metrics._

    Install the official Grafana dashboard: https://grafana.com/grafana/dashboards/12175

  2. mikejoh revised this gist Feb 25, 2021. 1 changed file with 11 additions and 5 deletions.
    16 changes: 11 additions & 5 deletions monitor-calico-felix-using-prom-op-in-k8s.md
    Original file line number Diff line number Diff line change
    @@ -13,15 +13,15 @@ Create a `Service` with `clusterIP` set to `None`, the service will be used to e
    apiVersion: v1
    kind: Service
    metadata:
    name: felix-metrics
    name: calico-felix-metrics
    namespace: kube-system
    labels:
    k8s-app: calico-node
    monitoring: calico-felix
    spec:
    clusterIP: None
    ports:
    - port: 9091
    protocol: TCP
    protocol: TCP
    name: metrics
    selector:
    k8s-app: calico-node
    @@ -32,19 +32,25 @@ Create a `ServiceMonitor` to start scrape the `calico-node` `Pods`:
    apiVersion: monitoring.coreos.com/v1
    kind: ServiceMonitor
    metadata:
    name: felix-metrics
    name: calico-felix-metrics
    namespace: monitoring
    spec:
    selector:
    matchLabels:
    k8s-app: calico-node
    monitoring: calico-felix
    namespaceSelector:
    matchNames:
    - kube-system
    endpoints:
    - port: metrics
    relabelings:
    - sourceLabels:
    - __meta_kubernetes_endpoint_node_name
    targetLabel: instance
    ```

    _Note the relabeling added to have a more descritive `instance` label of the scraped Calico Felix metrics._

    Install the official Grafana dashboard: https://grafana.com/grafana/dashboards/12175

    ## Links
  3. mikejoh revised this gist Feb 24, 2021. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion monitor-calico-felix-using-prom-op-in-k8s.md
    Original file line number Diff line number Diff line change
    @@ -45,4 +45,9 @@ spec:
    - port: metrics
    ```

    Install the official Grafana dashboard: https://grafana.com/grafana/dashboards/12175
    Install the official Grafana dashboard: https://grafana.com/grafana/dashboards/12175

    ## Links

    https://docs.projectcalico.org/reference/felix/prometheus
    https://docs.projectcalico.org/archive/v3.18/reference/felix/configuration
  4. mikejoh created this gist Feb 24, 2021.
    48 changes: 48 additions & 0 deletions monitor-calico-felix-using-prom-op-in-k8s.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,48 @@
    # Monitor Calico Felix using Prometheus Operator

    Make sure you have these settings enabled in `felix`, in this case using enviornment variables:
    ```
    FELIX_PROMETHEUSMETRICSENABLED = True
    FELIX_PROMETHEUSMETRICSPORT = "9091"
    FELIX_PROMETHEUSGOMETRICSENABLED = True
    FELIX_PROMETHEUSPROCESSMETRICSENABLED = True
    ```

    Create a `Service` with `clusterIP` set to `None`, the service will be used to enumerate endpoints to scrape:
    ```
    apiVersion: v1
    kind: Service
    metadata:
    name: felix-metrics
    namespace: kube-system
    labels:
    k8s-app: calico-node
    spec:
    clusterIP: None
    ports:
    - port: 9091
    protocol: TCP
    name: metrics
    selector:
    k8s-app: calico-node
    ```

    Create a `ServiceMonitor` to start scrape the `calico-node` `Pods`:
    ```
    apiVersion: monitoring.coreos.com/v1
    kind: ServiceMonitor
    metadata:
    name: felix-metrics
    namespace: monitoring
    spec:
    selector:
    matchLabels:
    k8s-app: calico-node
    namespaceSelector:
    matchNames:
    - kube-system
    endpoints:
    - port: metrics
    ```

    Install the official Grafana dashboard: https://grafana.com/grafana/dashboards/12175