'Azure policies(gatekeeper) monitoring on AKS via Prometheus and Grafana

I have enabled azure policies via terraform and applied to AKS cluster. I can see pods are deployed, up and running. I applied in-built initiative here too with effect "audit" to test out how azure policies works on aks cluster.

$ kubectl get pods -n gatekeeper-system
NAME                                    READY   STATUS    RESTARTS   AGE
gatekeeper-audit-77754c7d8-g44qb        1/1     Running   0          44h
gatekeeper-controller-78cff9c89-7pftn   1/1     Running   0          44h
gatekeeper-controller-78cff9c89-8dsfg   1/1     Running   0          44h

I found a dashboard https://grafana.com/grafana/dashboards/15763

But some of the metrics are different/missing. Not sure, because, azure managing this gatekeeper!?. I see below some panel are displaying and metrics are available in prometheus. For example below opa_scorecard_constraint_violations not avilable. enter image description here

How to monitor azure policies via prometheus properly



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source