All Projects → flant → K8s Image Availability Exporter

flant / K8s Image Availability Exporter

Licence: apache-2.0
Alert if an image used in Kubernetes cannot be pulled from container registry

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to K8s Image Availability Exporter

Jmx exporter
A process for exposing JMX Beans via HTTP for Prometheus consumption
Stars: ✭ 2,134 (+2077.55%)
Mutual labels:  monitoring, prometheus-exporter
Exporterhub.io
A Curated List of Prometheus Exporters
Stars: ✭ 252 (+157.14%)
Mutual labels:  monitoring, prometheus-exporter
Oracledb exporter
Prometheus Oracle database exporter.
Stars: ✭ 209 (+113.27%)
Mutual labels:  monitoring, prometheus-exporter
Nvidia gpu prometheus exporter
NVIDIA GPU Prometheus Exporter
Stars: ✭ 138 (+40.82%)
Mutual labels:  monitoring, prometheus-exporter
Snmp exporter
SNMP Exporter for Prometheus
Stars: ✭ 705 (+619.39%)
Mutual labels:  monitoring, prometheus-exporter
Kube Opex Analytics
🎨 Kubernetes Cost Allocation and Capacity Planning Analytics Tool. Hourly, daily, monthly reports - Prometheus exporter - Built-in & Grafana dashboard.
Stars: ✭ 232 (+136.73%)
Mutual labels:  monitoring, prometheus-exporter
Github Exporter
Prometheus exporter for github metrics
Stars: ✭ 231 (+135.71%)
Mutual labels:  monitoring, prometheus-exporter
Kube State Metrics
Add-on agent to generate and expose cluster-level metrics.
Stars: ✭ 3,433 (+3403.06%)
Mutual labels:  monitoring, prometheus-exporter
Nexclipper
Metrics Pipeline for interoperability and Enterprise Prometheus
Stars: ✭ 533 (+443.88%)
Mutual labels:  monitoring, prometheus-exporter
Statping
Status Page for monitoring your websites and applications with beautiful graphs, analytics, and plugins. Run on any type of environment.
Stars: ✭ 5,806 (+5824.49%)
Mutual labels:  monitoring, prometheus-exporter
Prometheus smart exporter
Configurable S.M.A.R.T. metric exporter for Prometheus
Stars: ✭ 38 (-61.22%)
Mutual labels:  monitoring, prometheus-exporter
Postgresql exporter
A Prometheus exporter for some postgresql metrics
Stars: ✭ 26 (-73.47%)
Mutual labels:  monitoring, prometheus-exporter
Unifi exporter
Multiarch images for scraping Prometheus metrics from a Unifi Controller. Kubernetes / prometheus-operator compatible.
Stars: ✭ 54 (-44.9%)
Mutual labels:  monitoring, prometheus-exporter
Prometheus Hystrix
This is an implementation of a HystrixMetricsPublisher that publishes metrics using the Prometheus java client.
Stars: ✭ 91 (-7.14%)
Mutual labels:  prometheus-exporter
Dockdash
Docker dashboard using Termui
Stars: ✭ 96 (-2.04%)
Mutual labels:  monitoring
Es Stats
ElasticSearch cluster metrics -> Graphite
Stars: ✭ 91 (-7.14%)
Mutual labels:  monitoring
Stackdriver Prometheus Sidecar
A sidecar for the Prometheus server that can send metrics to Stackdriver.
Stars: ✭ 91 (-7.14%)
Mutual labels:  monitoring
Netfil
A kernel network manager with monitoring and limiting capabilities for macOS. #nsacyber
Stars: ✭ 97 (-1.02%)
Mutual labels:  monitoring
Nodefony Starter
Nodefony Starter Node.js Framework
Stars: ✭ 95 (-3.06%)
Mutual labels:  monitoring
Vpndemon
Monitor a VPN connection on Linux and kill a process upon disconnect
Stars: ✭ 90 (-8.16%)
Mutual labels:  monitoring

k8s-image-availability-exporter

Docker images Latest Docker image

k8s-image-availability-exporter (or k8s-iae for short) is a Prometheus exporter that warns you proactively about images that are defined in Kubernetes objects (e.g., an image field in the Deployment) but are not available in the container registry (such as Docker Registry, etc.).

Receiving alerts when container images related to running Kubernetes controllers are missing helps you to solve the problem before it manifests itself. For more details on the reasons behind k8s-iae and how it works, please read this article.

Deploying

After cloning this repo:

kubectl apply -f deploy/

Prometheus integration

Here's how you can configure Prometheus or prometheus-operator to scrape metrics from k8s-image-availability-exporter.

Prometheus

- job_name: image-availability-exporter
  honor_labels: true
  metrics_path: '/metrics'
  scheme: http
  kubernetes_sd_configs:
  - role: pod
    namespaces:
      names:
      - kube-system
  relabel_configs:
  - source_labels: [__meta_kubernetes_pod_label_app]
    regex: image-availability-exporter
    action: keep

prometheus-operator

apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
  name: image-availability-exporter
  namespace: kube-system
spec:
  podMetricsEndpoints:
  - port: http-metrics
    scheme: http
    honorLabels: true
    scrapeTimeout: 10s
  selector:
    matchLabels:
      app: image-availability-exporter
  namespaceSelector:
    matchNames:
    - kube-system

Alerting

Here's how to alert based on these metrics:

Prometheus

groups:
- name: image-availability-exporter.rules
  rules:
  - alert: DeploymentImageUnavailable
    expr: |
      max by (namespace, deployment, container, image) (
        k8s_image_availability_exporter_deployment_available == 0
      )
    annotations:
      description: >
        Check image's `{{ $labels.image }}` availability in container registry
        in Namespace `{{ $labels.namespace }}`
        in Deployment `{{ $labels.owner_name }}`
        in container `{{ $labels.container }}` in registry.
      summary: Image `{{ $labels.image }}` is unavailable in container registry.

  - alert: StatefulSetImageUnavailable
    expr: |
      max by (namespace, statefulset, container, image) (
        k8s_image_availability_exporter_statefulset_available == 0
      )
    annotations:
      description: >
        Check image's `{{ $labels.image }}` availability in container registry
        in Namespace `{{ $labels.namespace }}`
        in StatefulSet `{{ $labels.owner_name }}`
        in container `{{ $labels.container }}` in registry.
      summary: Image `{{ $labels.image }}` is unavailable in container registry.

  - alert: DaemonSetImageUnavailable
    expr: |
      max by (namespace, daemonset, container, image) (
        k8s_image_availability_exporter_daemonset_available == 0
      )
    annotations:
      description: >
        Check image's `{{ $labels.image }}` availability in container registry
        in Namespace `{{ $labels.namespace }}`
        in DaemonSet `{{ $labels.owner_name }}`
        in container `{{ $labels.container }}` in registry.
      summary: Image `{{ $labels.image }}` is unavailable in container registry.

  - alert: CronJobImageUnavailable
    expr: |
      max by (namespace, cronjob, container, image) (
        k8s_image_availability_exporter_cronjob_available == 0
      )
    annotations:
      description: >
        Check image's `{{ $labels.image }}` availability in container registry
        in Namespace `{{ $labels.namespace }}`
        in CronJob `{{ $labels.owner_name }}`
        in container `{{ $labels.container }}` in registry.
      summary: Image `{{ $labels.image }}` is unavailable in container registry.

prometheus-operator

apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  name: image-availability-exporter-alerts
  namespace: kube-system
spec:
  groups:
  - name: image-availability-exporter.rules
    rules:

    - alert: DeploymentImageUnavailable
      expr: |
        max by (namespace, deployment, container, image) (
          k8s_image_availability_exporter_deployment_available == 0
        )
      annotations:
        description: >
          Check image's `{{ $labels.image }}` availability in container registry
          in Namespace `{{ $labels.namespace }}`
          in Deployment `{{ $labels.owner_name }}`
          in container `{{ $labels.container }}` in registry.
        summary: Image `{{ $labels.image }}` is unavailable.
    
    - alert: StatefulSetImageUnavailable
      expr: |
        max by (namespace, statefulset, container, image) (
          k8s_image_availability_exporter_statefulset_available == 0
        )
      annotations:
        description: >
          Check image's `{{ $labels.image }}` availability in container registry
          in Namespace `{{ $labels.namespace }}`
          in StatefulSet `{{ $labels.owner_name }}`
          in container `{{ $labels.container }}` in registry.
        summary: Image `{{ $labels.image }}` is unavailable in container registry.
    
    - alert: DaemonSetImageUnavailable
      expr: |
        max by (namespace, daemonset, container, image) (
          k8s_image_availability_exporter_daemonset_available == 0
        )
      annotations:
        description: >
          Check image's `{{ $labels.image }}` availability in container registry
          in Namespace `{{ $labels.namespace }}`
          in DaemonSet `{{ $labels.owner_name }}`
          in container `{{ $labels.container }}` in registry.
        summary: Image `{{ $labels.image }}` is unavailable in container registry.
    
    - alert: CronJobImageUnavailable
      expr: |
        max by (namespace, cronjob, container, image) (
          k8s_image_availability_exporter_cronjob_available == 0
        )
      annotations:
        description: >
          Check image's `{{ $labels.image }}` availability in container registry
          in Namespace `{{ $labels.namespace }}`
          in CronJob `{{ $labels.owner_name }}`
          in container `{{ $labels.container }}` in registry.
        summary: Image `{{ $labels.image }}` is unavailable in container registry.

Configuration

Command-line options

  • --bind-address — IP address and port to bind to.
    • Default: :8080
  • --check-interval — interval for checking absent images. In Go time format.
    • Default: 5m
  • --ignored-images — comma-separated list of images to ignore while checking absent images.
  • --skip-registry-cert-verification — whether to skip registries' certificate verification.

Metrics

The following metrics for Prometheus are provided:

  • k8s_image_availability_exporter_<TYPE>_available — non-zero indicates successful image check.
  • k8s_image_availability_exporter_<TYPE>_bad_image_format — non-zero indicates incorrect image field format.
  • k8s_image_availability_exporter_<TYPE>_absent — non-zero indicates an image's manifest absence from container registry.
  • k8s_image_availability_exporter_<TYPE>_registry_unavailable — non-zero indicates general registry unavailiability, perhaps, due to network outage.
  • k8s_image_availability_exporter_deployment_registry_v1_api_not_supported — non-zero indicates v1 Docker Registry API, these images are best ignored with --ignored-images cmdline parameter.
  • k8s_image_availability_exporter_<TYPE>_authentication_failure — non-zero indicates authentication error to container registry, verify imagePullSecrets.
  • k8s_image_availability_exporter_<TYPE>_authorization_failure — non-zero indicates authorization error to container registry, verify imagePullSecrets.
  • k8s_image_availability_exporter_<TYPE>_unknown_error — non-zero indicates an error that failed to be classified, consult exporter's logs for additional information.

Each <TYPE> in the exporter's metrics name is replaced with the following values:

  • deployment
  • statefulset
  • daemonset
  • cronjob

Compatibility

k8s-image-availability-exporter is compatible with Kubernetes 1.15+ and Docker Registry V2 compliant container registries.

Since the exporter operates as a Deployment, it does not support container registries that should be accessed via authorization on a node.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].