diff --git a/README.md b/README.md index 26fd581..f7211e2 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,31 @@ ![License](https://img.shields.io/github/license/gkarthiks/container-resource-exporter.svg) ![Release](https://img.shields.io/github/tag-date/gkarthiks/container-resource-exporter.svg?color=Orange&label=Latest%20Release) -Container Resource Exporter (CRE) is a simple metrics expoerter which will export the following data in the [Prometheus](https://prometheus.io/) format. This can be utilized to trigger a pro-active alert from the the [Prometheus Alert Manager](https://prometheus.io/docs/alerting/alertmanager). +Container Resource Exporter (CRE) is a metrics expoerter which will provide the *container* resource `request/limit/usage` metrics data on realtime in the [Prometheus](https://prometheus.io/) format. This can be utilized to trigger a pro-active alert from the the [Prometheus Alert Manager](https://prometheus.io/docs/alerting/alertmanager). -### Sample CRE metrics exported: +## Cluster Level: +By default the *CRE* will watch for the entire cluster, scrapes the resources for each and every container and exports them along with the total count of pods in each namesapces. + +To run in the *cluster mode*, the *CRE* will require a *service account* which has cluster level read access and `list` actions on the resource `pods` in `core v1` apiGroup and `metrics` apiGroup. + + +## Contained Namespace: +To run the *CRE* in a contained namespace, i.e., watch only particular namespace; add the following environment variable `WATCH_NAMESPACE`. This can be easily accompolished with the `downward api` in *Kuberneres* as shown below. + +```yaml +- env: + - name: WATCH_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace ``` + +Still, *CRE* will require a *service account* which has access to `list` all the `pods` under `core v1` apiGroup and `metrics` apiGroup. + +### Sample CRE metrics exported: + +```prometheus # HELP cpu_limit CPU Limit by deployment # TYPE cpu_limit gauge cpu_limit{container_name="alertmanager",namespace="default",pod_name="prometheus-alertmanager-74bd9d5867-gmlj9",status="Running "} 1 @@ -45,3 +65,16 @@ total_pod{namespace="default"} 1 ``` Effortlessly get the Resources' request, limit and current usage by containers in your cluster/namespace. + +## Sample Grafana dashboard visualization +The below sample [Grafana](https://grafana.com/) dashboard will show the sample metrics record for +- Total pods in the namespace over the time +- Total CPU Limit/Request/Usage in the namespace +- Total Memory Limit/Request/Usage in the namespace +- A sample pod's CPU Utilization +- A sample pod's Memory Utilization + +![alt](./grafana-dashboard.jpeg) + +## Docker Image: +The docker image ofcan be found [here .](https://cloud.docker.com/repository/docker/gkarthics/container-resource-exporter) \ No newline at end of file diff --git a/docker-logo.png b/docker-logo.png new file mode 100644 index 0000000..2a95bee Binary files /dev/null and b/docker-logo.png differ diff --git a/grafana-dashboard.jpeg b/grafana-dashboard.jpeg new file mode 100644 index 0000000..aee04aa Binary files /dev/null and b/grafana-dashboard.jpeg differ