Grafana dashboard: Kubernetes Namespace Resources
Description: Display usage of ResourceQuota by namespace in kubernetes cluster. 

# Dashboard for k8s clusters that use kube-prometheus for collecting metrics.
## About Dashboard
This dashboard will help you visualize resource utilization per namespace with resource quota.
### Singlestat panels
* CPU Requests Allocated / CPU Requests Quota
* CPU Limits Allocated / CPU Limits Quota
* CPU Actual Usage / CPU Requests Quota
* CPU Actual Usage / CPU Limits Quota
* RAM Requests Allocated / RAM Requests Quota
* RAM Limits Allocated / RAM Limits Quota
* RAM Actual Usage / RAM Requests Quota
* RAM Actual Usage / RAM Limits Quota

### Graph panels
#### CPU
* CPU Usage
* CPU Quota Limits
* CPU Quota Requests
* CPU Allocated Limits
* CPU Allocated Requests

#### RAM
* RAM Usage
* RAM Quota Limits
* RAM Quota Requests
* RAM Allocated Limits
* RAM Allocated Requests

#### Network
* Input
* Output

## How to use
After importing dashboard - create variable $source that will contain the datasource (if you are using different datasources for different cluster), or just hardcode it.

## How to contribute
Feel free to make PR in [github repository](https://github.com/yuripastushenko/k8s-resource-quota-dashboards).

## Other k8s resources dashboards
* [Kubernetes Cluster Resources](https://grafana.com/dashboards/9766)
* [Kubernetes Pods/Containers Resources](https://grafana.com/dashboards/9810)

{
  "__inputs": [],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "5.4.3"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": "5.0.0"
    },
    {
      "type": "datasource",
      "id": "prometheus",
      "name": "Prometheus",
      "version": "5.0.0"
    },
    {
      "type": "panel",
      "id": "singlestat",
      "name": "Singlestat",
      "version": "5.0.0"
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": false,
  "gnetId": 9809,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1550397204054,
  "links": [],
  "panels": [
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#9ac48a",
        "#e5ac0e",
        "#d44a3a"
      ],
      "datasource": "$source",
      "format": "percent",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": true,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 0,
        "y": 0
      },
      "id": 5,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "bucketAggs": [
            {
              "field": "@timestamp",
              "id": "2",
              "settings": {
                "interval": "auto",
                "min_doc_count": 0,
                "trimEdges": 0
              },
              "type": "date_histogram"
            }
          ],
          "expr": "sum (kube_resourcequota{resource=\"requests.cpu\",type=\"used\",namespace=\"$namespace\"}) / sum(kube_resourcequota{resource=\"requests.cpu\",type=\"hard\",namespace=\"$namespace\"}) * 100",
          "format": "time_series",
          "intervalFactor": 1,
          "metrics": [
            {
              "field": "select field",
              "id": "1",
              "type": "count"
            }
          ],
          "query": "sum (kube_resourcequota{resource=\"requests.cpu\",type=\"used\",namespace=\"$namespace\"}) / sum(kube_resourcequota{resource=\"limits.cpu\",type=\"hard\",namespace=\"$namespace\"}) * 100",
          "refId": "A",
          "timeField": "@timestamp"
        }
      ],
      "thresholds": "60, 80",
      "title": "Requests Allocated / Requests Quota (CPU)",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "avg"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "$source",
      "format": "percent",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": true,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 4,
        "w": 7,
        "x": 6,
        "y": 0
      },
      "id": 4,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "bucketAggs": [
            {
              "field": "@timestamp",
              "id": "2",
              "settings": {
                "interval": "auto",
                "min_doc_count": 0,
                "trimEdges": 0
              },
              "type": "date_histogram"
            }
          ],
          "expr": "sum (kube_resourcequota{resource=\"limits.cpu\",type=\"used\",namespace=\"$namespace\"}) / sum(kube_resourcequota{resource=\"limits.cpu\",type=\"hard\",namespace=\"$namespace\"}) * 100",
          "format": "time_series",
          "intervalFactor": 1,
          "metrics": [
            {
              "field": "select field",
              "id": "1",
              "type": "count"
            }
          ],
          "query": "sum (kube_resourcequota{resource=\"requests.cpu\",type=\"used\",namespace=\"$namespace\"}) / sum(kube_resourcequota{resource=\"limits.cpu\",type=\"hard\",namespace=\"$namespace\"}) * 100",
          "refId": "A",
          "timeField": "@timestamp"
        }
      ],
      "thresholds": "60,90",
      "title": "Limits Allocated / Limits Quota (CPU)",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "avg"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#e24d42",
        "#9ac48a",
        "#d44a3a"
      ],
      "datasource": "$source",
      "format": "percent",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": true,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 13,
        "y": 0
      },
      "id": 6,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "bucketAggs": [
            {
              "field": "@timestamp",
              "id": "2",
              "settings": {
                "interval": "auto",
                "min_doc_count": 0,
                "trimEdges": 0
              },
              "type": "date_histogram"
            }
          ],
          "expr": "sum (rate(container_cpu_usage_seconds_total{namespace=\"$namespace\"}[1m])) / sum(kube_resourcequota{resource=\"requests.cpu\",type=\"hard\",namespace=\"$namespace\"}) * 100",
          "format": "time_series",
          "intervalFactor": 1,
          "metrics": [
            {
              "field": "select field",
              "id": "1",
              "type": "count"
            }
          ],
          "query": "sum (kube_resourcequota{resource=\"requests.cpu\",type=\"used\",namespace=\"$namespace\"}) / sum(kube_resourcequota{resource=\"limits.cpu\",type=\"hard\",namespace=\"$namespace\"}) * 100",
          "refId": "A",
          "timeField": "@timestamp"
        }
      ],
      "thresholds": "80,100",
      "title": "Actual Usage / Request Quota (CPU)",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "avg"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "$source",
      "format": "percent",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": true,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 4,
        "w": 5,
        "x": 19,
        "y": 0
      },
      "id": 11,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "bucketAggs": [
            {
              "field": "@timestamp",
              "id": "2",
              "settings": {
                "interval": "auto",
                "min_doc_count": 0,
                "trimEdges": 0
              },
              "type": "date_histogram"
            }
          ],
          "expr": "sum (rate(container_cpu_usage_seconds_total{namespace=\"$namespace\"}[1m])) / sum(kube_resourcequota{resource=\"limits.cpu\",type=\"hard\",namespace=\"$namespace\"}) * 100",
          "format": "time_series",
          "intervalFactor": 1,
          "metrics": [
            {
              "field": "select field",
              "id": "1",
              "type": "count"
            }
          ],
          "query": "sum (kube_resourcequota{resource=\"requests.cpu\",type=\"used\",namespace=\"$namespace\"}) / sum(kube_resourcequota{resource=\"limits.cpu\",type=\"hard\",namespace=\"$namespace\"}) * 100",
          "refId": "A",
          "timeField": "@timestamp"
        }
      ],
      "thresholds": "60,90",
      "title": "Actual Usage / Limits Quota (CPU)",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "avg"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#9ac48a",
        "#e5ac0e",
        "#d44a3a"
      ],
      "datasource": "$source",
      "format": "percent",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": true,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 0,
        "y": 4
      },
      "id": 8,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "bucketAggs": [
            {
              "field": "@timestamp",
              "id": "2",
              "settings": {
                "interval": "auto",
                "min_doc_count": 0,
                "trimEdges": 0
              },
              "type": "date_histogram"
            }
          ],
          "expr": "sum (kube_resourcequota{resource=\"requests.memory\",type=\"used\",namespace=\"$namespace\"}) / sum(kube_resourcequota{resource=\"requests.memory\",type=\"hard\",namespace=\"$namespace\"}) * 100",
          "format": "time_series",
          "intervalFactor": 1,
          "metrics": [
            {
              "field": "select field",
              "id": "1",
              "type": "count"
            }
          ],
          "query": "sum (kube_resourcequota{resource=\"requests.cpu\",type=\"used\",namespace=\"$namespace\"}) / sum(kube_resourcequota{resource=\"limits.cpu\",type=\"hard\",namespace=\"$namespace\"}) * 100",
          "refId": "A",
          "timeField": "@timestamp"
        }
      ],
      "thresholds": "60,80",
      "title": "Requests Allocated / Requests Quota (Memory)",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "avg"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "$source",
      "format": "percent",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": true,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 4,
        "w": 7,
        "x": 6,
        "y": 4
      },
      "id": 7,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "bucketAggs": [
            {
              "field": "@timestamp",
              "id": "2",
              "settings": {
                "interval": "auto",
                "min_doc_count": 0,
                "trimEdges": 0
              },
              "type": "date_histogram"
            }
          ],
          "expr": "sum (kube_resourcequota{resource=\"limits.memory\",type=\"used\",namespace=\"$namespace\"}) / sum(kube_resourcequota{resource=\"limits.memory\",type=\"hard\",namespace=\"$namespace\"}) * 100",
          "format": "time_series",
          "intervalFactor": 1,
          "metrics": [
            {
              "field": "select field",
              "id": "1",
              "type": "count"
            }
          ],
          "query": "sum (kube_resourcequota{resource=\"requests.cpu\",type=\"used\",namespace=\"$namespace\"}) / sum(kube_resourcequota{resource=\"limits.cpu\",type=\"hard\",namespace=\"$namespace\"}) * 100",
          "refId": "A",
          "timeField": "@timestamp"
        }
      ],
      "thresholds": "60,90",
      "title": "Limits Allocated / Limits Quota (Memory)",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "avg"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#e24d42",
        "#9ac48a",
        "#d44a3a"
      ],
      "datasource": "$source",
      "format": "percent",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": true,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 13,
        "y": 4
      },
      "id": 10,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "bucketAggs": [
            {
              "field": "@timestamp",
              "id": "2",
              "settings": {
                "interval": "auto",
                "min_doc_count": 0,
                "trimEdges": 0
              },
              "type": "date_histogram"
            }
          ],
          "expr": "sum (container_memory_working_set_bytes{image!=\"\",name=~\"^k8s_.*\", namespace=\"$namespace\"}) / sum(kube_resourcequota{resource=\"requests.memory\",type=\"hard\",namespace=\"$namespace\"}) * 100",
          "format": "time_series",
          "intervalFactor": 1,
          "metrics": [
            {
              "field": "select field",
              "id": "1",
              "type": "count"
            }
          ],
          "query": "sum (kube_resourcequota{resource=\"requests.cpu\",type=\"used\",namespace=\"$namespace\"}) / sum(kube_resourcequota{resource=\"limits.cpu\",type=\"hard\",namespace=\"$namespace\"}) * 100",
          "refId": "A",
          "timeField": "@timestamp"
        }
      ],
      "thresholds": "80,100",
      "title": "Actual Usage / Request Quota (Memory)",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "avg"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "$source",
      "format": "percent",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": true,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 4,
        "w": 5,
        "x": 19,
        "y": 4
      },
      "id": 9,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "bucketAggs": [
            {
              "field": "@timestamp",
              "id": "2",
              "settings": {
                "interval": "auto",
                "min_doc_count": 0,
                "trimEdges": 0
              },
              "type": "date_histogram"
            }
          ],
          "expr": "sum (container_memory_working_set_bytes{image!=\"\",name=~\"^k8s_.*\", namespace=\"$namespace\"}) / sum(kube_resourcequota{resource=\"limits.memory\",type=\"hard\",namespace=\"$namespace\"}) * 100",
          "format": "time_series",
          "intervalFactor": 1,
          "metrics": [
            {
              "field": "select field",
              "id": "1",
              "type": "count"
            }
          ],
          "query": "sum (kube_resourcequota{resource=\"requests.cpu\",type=\"used\",namespace=\"$namespace\"}) / sum(kube_resourcequota{resource=\"limits.cpu\",type=\"hard\",namespace=\"$namespace\"}) * 100",
          "refId": "A",
          "timeField": "@timestamp"
        }
      ],
      "thresholds": "60,90",
      "title": "Actual Usage / Limits Quota (Memory)",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "avg"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "$source",
      "description": "This represents the total [CPU resource requests](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#meaning-of-cpu) in the cluster.\nFor comparison the total [allocatable CPU cores](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/node-allocatable.md) is also shown.",
      "editable": true,
      "error": false,
      "fill": 1,
      "grid": {
        "threshold1Color": "rgba(216, 200, 27, 0.27)",
        "threshold2Color": "rgba(234, 112, 112, 0.22)"
      },
      "gridPos": {
        "h": 8,
        "w": 24,
        "x": 0,
        "y": 8
      },
      "id": 1,
      "isNew": false,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "hideEmpty": false,
        "hideZero": false,
        "max": false,
        "min": false,
        "rightSide": true,
        "show": true,
        "sideWidth": 250,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [
        {
          "alias": "CPU Actual Usage",
          "fill": 5
        },
        {
          "alias": "CPU Actual Usage",
          "linewidth": 3
        }
      ],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "sum (rate(container_cpu_usage_seconds_total{namespace=\"$namespace\"}[1m]))",
          "format": "time_series",
          "hide": false,
          "intervalFactor": 1,
          "legendFormat": "CPU Usage",
          "refId": "E"
        },
        {
          "expr": "kube_resourcequota{namespace=\"$namespace\", resource=\"limits.cpu\", type=\"hard\"}",
          "format": "time_series",
          "hide": false,
          "intervalFactor": 1,
          "legendFormat": "CPU Quota Limits",
          "refId": "A",
          "step": 20
        },
        {
          "expr": "kube_resourcequota{namespace=\"$namespace\", resource=\"requests.cpu\", type=\"hard\"}",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "CPU Quota Requests",
          "refId": "C"
        },
        {
          "expr": "kube_resourcequota{namespace=\"$namespace\", resource=\"limits.cpu\", type=\"used\"}",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "CPU Allocated Limits",
          "refId": "B"
        },
        {
          "expr": "kube_resourcequota{namespace=\"$namespace\", resource=\"requests.cpu\", type=\"used\"}",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "CPU Allocated Requests",
          "refId": "D"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "CPU",
      "tooltip": {
        "msResolution": false,
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "decimals": null,
          "format": "short",
          "label": "CPU Cores",
          "logBase": 1,
          "min": "0",
          "show": true
        },
        {
          "format": "short",
          "logBase": 1,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "$source",
      "description": "This represents the total [CPU resource requests](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#meaning-of-cpu) in the cluster.\nFor comparison the total [allocatable CPU cores](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/node-allocatable.md) is also shown.",
      "editable": true,
      "error": false,
      "fill": 1,
      "grid": {
        "threshold1Color": "rgba(216, 200, 27, 0.27)",
        "threshold2Color": "rgba(234, 112, 112, 0.22)"
      },
      "gridPos": {
        "h": 8,
        "w": 24,
        "x": 0,
        "y": 16
      },
      "id": 2,
      "isNew": false,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "hideEmpty": false,
        "hideZero": false,
        "max": false,
        "min": false,
        "rightSide": true,
        "show": true,
        "sideWidth": 250,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [
        {
          "alias": "Actual Usage",
          "linewidth": 3
        },
        {
          "alias": "Actual Usage",
          "fill": 5
        }
      ],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "sum (container_memory_working_set_bytes{image!=\"\",name=~\"^k8s_.*\", namespace=\"$namespace\"})",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "Actual Usage",
          "refId": "E"
        },
        {
          "expr": "kube_resourcequota{namespace=\"$namespace\", resource=\"limits.memory\", type=\"hard\"}",
          "format": "time_series",
          "hide": false,
          "instant": false,
          "interval": "",
          "intervalFactor": 1,
          "legendFormat": "Memory Quota Limits",
          "refId": "A",
          "step": 20
        },
        {
          "expr": "kube_resourcequota{namespace=\"$namespace\", resource=\"requests.memory\", type=\"hard\"}",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "Memory Quota Requests",
          "refId": "C"
        },
        {
          "expr": "kube_resourcequota{namespace=\"$namespace\", resource=\"limits.memory\", type=\"used\"}",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "Memory Allocated Limits",
          "refId": "B"
        },
        {
          "expr": "kube_resourcequota{namespace=\"$namespace\", resource=\"requests.memory\", type=\"used\"}",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "Memory Allocated Requests",
          "refId": "D"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Memory",
      "tooltip": {
        "msResolution": false,
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "decimals": null,
          "format": "bytes",
          "label": "Memory",
          "logBase": 1,
          "min": "0",
          "show": true
        },
        {
          "decimals": null,
          "format": "short",
          "label": "",
          "logBase": 1,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "$source",
      "editable": true,
      "error": false,
      "fill": 1,
      "grid": {
        "threshold1Color": "rgba(216, 200, 27, 0.27)",
        "threshold2Color": "rgba(234, 112, 112, 0.22)"
      },
      "gridPos": {
        "h": 7,
        "w": 24,
        "x": 0,
        "y": 24
      },
      "id": 13,
      "isNew": false,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "hideEmpty": false,
        "hideZero": false,
        "max": true,
        "min": false,
        "rightSide": true,
        "show": true,
        "sideWidth": 250,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 2,
      "links": [],
      "nullPointMode": "connected",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "sort_desc(sum (rate(container_network_receive_bytes_total{namespace=\"$namespace\"}[1m])))",
          "format": "time_series",
          "intervalFactor": 2,
          "legendFormat": "Network Input",
          "refId": "A",
          "step": 30
        },
        {
          "expr": "sort_desc(sum (rate(container_network_transmit_bytes_total{namespace=\"$namespace\"}[1m])))",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "Networt Output",
          "refId": "B"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Network I/O",
      "tooltip": {
        "msResolution": true,
        "shared": true,
        "sort": 0,
        "value_type": "cumulative"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "bytes",
          "logBase": 1,
          "show": true
        },
        {
          "format": "short",
          "logBase": 1,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    }
  ],
  "refresh": false,
  "schemaVersion": 16,
  "style": "dark",
  "tags": [
    "kubernetes"
  ],
  "templating": {
    "list": [
      {
        "current": {
          "text": "k8s-int",
          "value": "k8s-int"
        },
        "hide": 0,
        "label": "Cluster",
        "name": "source",
        "options": [],
        "query": "prometheus",
        "refresh": 1,
        "regex": "/^k8s/",
        "skipUrlSync": false,
        "type": "datasource"
      },
      {
        "allValue": ".*",
        "current": {},
        "datasource": "$source",
        "definition": "",
        "hide": 0,
        "includeAll": true,
        "label": "Namespace",
        "multi": false,
        "name": "namespace",
        "options": [],
        "query": "label_values(kube_pod_info, namespace)",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "time": {
    "from": "now-5m",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ],
    "time_options": [
      "5m",
      "15m",
      "1h",
      "6h",
      "12h",
      "24h",
      "2d",
      "7d",
      "30d"
    ]
  },
  "timezone": "",
  "title": "Kubernetes Namespace Resources",
  "uid": "P2SL71Nmk",
  "version": 32,
  "description": "Display usage of ResourceQuota by namespace in kubernetes cluster. "
}