The purpose of this deployment is to achieve redundancy, high-availability using Kubernetes and gnmic's internal clustering mechanism.

This deployment example includes:

The leader election and target distribution is done with the help of a Consul server

gnmic can be discovered by Prometheus using Kubernetes service discovery. Kubernetes uses a headless service with a StatefulSet to disable the internal load balancing across multiple pods of the same StatefulSet and allow Prometheus to discover all instances of gnmic.

Prometheus Operator must be installed prior to gnmic deployment. (Can also be installed via kube-prometheus-stack helm chart or kube-prometheus)

Deployment files:

Download the files, update the gnmic ConfigMap with the desired subscriptions and targets and make sure that prometheus servicemonitor is in a namespace or has a label that Prometheus operator is watching.

Deploy it with:

kubectl create ns gnmic
kubectl apply -n gnmic -f kubernetes/consul
kubectl apply -n gnmic -f kubernetes/gnmic-app
# Before deploying the Prometheus ServiceMonitor
# Install Prometheus operator or kube-prometheus or kube-prometheus-stack helm chart
# Otherwise the command will fail
kubectl apply -f kubernetes/prometheus

Check the Prometheus Output documentation page for more configuration options.