Kubernetes Pre-Deployment Checks
Check your workload health before doing modifications to your cluster
{
  "__inputs": [
    {
      "name": "DS_PROMETHEUS",
      "label": "prometheus",
      "description": "",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    }
  ],
  "__requires": [
    {
      "type": "panel",
      "id": "gauge",
      "name": "Gauge",
      "version": ""
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "7.5.4"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "prometheus",
      "name": "Prometheus",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    },
    {
      "type": "panel",
      "id": "text",
      "name": "Text",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "gnetId": 15163,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "panels": [
    {
      "collapsed": false,
      "datasource": null,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 6,
      "panels": [],
      "title": "Unhealthy Workloads",
      "type": "row"
    },
    {
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "max": 10,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 1
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Value"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Current Healthy Pods"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 5,
        "w": 3,
        "x": 0,
        "y": 1
      },
      "id": 13,
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showThresholdLabels": false,
        "showThresholdMarkers": true,
        "text": {}
      },
      "pluginVersion": "7.5.4",
      "targets": [
        {
          "exemplar": true,
          "expr": "count((kube_poddisruptionbudget_status_current_healthy != 0) * on(poddisruptionbudget) group_left(namespace,container) ( (kube_poddisruptionbudget_status_pod_disruptions_allowed == 0) + 1 )) by (poddisruptionbudget, namespace)",
          "format": "table",
          "instant": true,
          "interval": "",
          "legendFormat": "Current Healthy Pods",
          "queryType": "randomWalk",
          "refId": "A"
        }
      ],
      "title": "PDBs preventing any disruptions",
      "type": "gauge"
    },
    {
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": null,
            "filterable": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Value"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Current Healthy Pods"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 5,
        "w": 17,
        "x": 3,
        "y": 1
      },
      "id": 2,
      "options": {
        "showHeader": true,
        "sortBy": [
          {
            "desc": false,
            "displayName": "{container=\"kube-rbac-proxy-main\", instance=\"10.32.0.14:8443\", job=\"kube-state-metrics\", namespace=\"monitoring\", poddisruptionbudget=\"prometheus-k8s\"}"
          }
        ]
      },
      "pluginVersion": "7.5.4",
      "targets": [
        {
          "exemplar": true,
          "expr": "avg((kube_poddisruptionbudget_status_current_healthy != 0) * on(poddisruptionbudget) group_left(namespace,container) ( (kube_poddisruptionbudget_status_pod_disruptions_allowed == 0) + 1 )) by (poddisruptionbudget, namespace)",
          "format": "table",
          "instant": true,
          "interval": "",
          "legendFormat": "Current Healthy Pods",
          "queryType": "randomWalk",
          "refId": "A"
        }
      ],
      "title": "PDBs preventing any disruptions",
      "type": "table"
    },
    {
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "max": 20,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 10
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 11,
        "w": 6,
        "x": 0,
        "y": 6
      },
      "id": 14,
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showThresholdLabels": false,
        "showThresholdMarkers": true,
        "text": {}
      },
      "pluginVersion": "7.5.4",
      "targets": [
        {
          "exemplar": true,
          "expr": "count(avg(kube_pod_status_phase{phase!=\"Succeeded\",phase!=\"Running\"} == 1) by (namespace, pod))",
          "format": "table",
          "hide": false,
          "instant": true,
          "interval": "",
          "legendFormat": "",
          "queryType": "randomWalk",
          "refId": "A"
        }
      ],
      "title": "Pods With Unhealthy Status",
      "transformations": [],
      "type": "gauge"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {},
        "overrides": []
      },
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 11,
        "w": 6,
        "x": 6,
        "y": 6
      },
      "hiddenSeries": false,
      "id": 16,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "7.5.4",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "exemplar": true,
          "expr": "count(avg(kube_pod_status_phase{phase!=\"Succeeded\",phase!=\"Running\"} == 1) by (namespace, pod))",
          "format": "table",
          "hide": false,
          "instant": false,
          "interval": "",
          "legendFormat": "",
          "queryType": "randomWalk",
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Pods With Unhealthy Status",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "transformations": [],
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": null,
            "filterable": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 11,
        "w": 9,
        "x": 12,
        "y": 6
      },
      "id": 3,
      "options": {
        "showHeader": true,
        "sortBy": [
          {
            "desc": false,
            "displayName": "Current Healthy Pods"
          }
        ]
      },
      "pluginVersion": "7.5.4",
      "targets": [
        {
          "exemplar": true,
          "expr": "avg(kube_pod_status_phase{phase!=\"Succeeded\",phase!=\"Running\"} == 1) by (namespace, pod)",
          "format": "table",
          "hide": false,
          "instant": true,
          "interval": "",
          "legendFormat": "",
          "queryType": "randomWalk",
          "refId": "A"
        }
      ],
      "title": "Pods With Unhealthy Status",
      "transformations": [
        {
          "id": "filterFieldsByName",
          "options": {
            "include": {
              "names": [
                "Time",
                "container",
                "namespace",
                "pod",
                "pod_phase"
              ]
            }
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "max": 10,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 1
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 5,
        "w": 4,
        "x": 0,
        "y": 17
      },
      "id": 15,
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showThresholdLabels": false,
        "showThresholdMarkers": true,
        "text": {}
      },
      "pluginVersion": "7.5.4",
      "targets": [
        {
          "exemplar": true,
          "expr": "count((kube_pod_container_status_ready == 0) * on(pod) group_left(pod_phase) label_replace(kube_pod_status_phase{phase=\"Running\"} == 1,\"pod_phase\",\"$1\",\"phase\",\"(.*)\")) by (namespace,pod,pod_phase)",
          "format": "table",
          "hide": false,
          "instant": true,
          "interval": "",
          "legendFormat": "",
          "queryType": "randomWalk",
          "refId": "A"
        }
      ],
      "title": "Running Pods with Not Ready containers",
      "transformations": [],
      "type": "gauge"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {},
        "overrides": []
      },
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 5,
        "w": 4,
        "x": 4,
        "y": 17
      },
      "hiddenSeries": false,
      "id": 17,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "7.5.4",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "exemplar": true,
          "expr": "count((kube_pod_container_status_ready == 0) * on(pod) group_left(pod_phase) label_replace(kube_pod_status_phase{phase=\"Running\"} == 1,\"pod_phase\",\"$1\",\"phase\",\"(.*)\")) by (namespace,pod,pod_phase)",
          "format": "table",
          "hide": false,
          "instant": false,
          "interval": "",
          "legendFormat": "",
          "queryType": "randomWalk",
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Running Pods with Not Ready containers",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "transformations": [],
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": null,
            "filterable": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 5,
        "w": 11,
        "x": 8,
        "y": 17
      },
      "id": 4,
      "options": {
        "showHeader": true,
        "sortBy": [
          {
            "desc": false,
            "displayName": "Current Healthy Pods"
          }
        ]
      },
      "pluginVersion": "7.5.4",
      "targets": [
        {
          "exemplar": true,
          "expr": "count((kube_pod_container_status_ready == 0) * on(pod) group_left(pod_phase) label_replace(kube_pod_status_phase{phase=\"Running\"} == 1,\"pod_phase\",\"$1\",\"phase\",\"(.*)\")) by (namespace,pod,pod_phase)",
          "format": "table",
          "hide": false,
          "instant": true,
          "interval": "",
          "legendFormat": "",
          "queryType": "randomWalk",
          "refId": "A"
        }
      ],
      "title": "Running Pods with Not Ready containers",
      "transformations": [
        {
          "id": "filterFieldsByName",
          "options": {
            "include": {
              "names": [
                "Time",
                "container",
                "namespace",
                "pod",
                "pod_phase"
              ]
            }
          }
        }
      ],
      "type": "table"
    },
    {
      "collapsed": false,
      "datasource": null,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 22
      },
      "id": 8,
      "panels": [],
      "title": "Manual/Other Checks",
      "type": "row"
    },
    {
      "datasource": null,
      "description": "",
      "fieldConfig": {
        "defaults": {},
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 6,
        "x": 0,
        "y": 23
      },
      "id": 10,
      "options": {
        "content": "# Check Age of Last Backup\n",
        "mode": "markdown"
      },
      "pluginVersion": "7.5.4",
      "targets": [
        {
          "queryType": "randomWalk",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "type": "text"
    },
    {
      "datasource": null,
      "description": "",
      "fieldConfig": {
        "defaults": {},
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 6,
        "x": 6,
        "y": 23
      },
      "id": 12,
      "options": {
        "content": "# Check Available Capacity\n",
        "mode": "markdown"
      },
      "pluginVersion": "7.5.4",
      "targets": [
        {
          "queryType": "randomWalk",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "type": "text"
    },
    {
      "datasource": null,
      "description": "",
      "fieldConfig": {
        "defaults": {},
        "overrides": []
      },
      "gridPos": {
        "h": 5,
        "w": 12,
        "x": 0,
        "y": 26
      },
      "id": 11,
      "options": {
        "content": "# Check All Pod Images Can Be Pulled\n\nGet all images:\n` images=\"$(k get po -o json -A | jq -r \".items[].spec.containers[].image\" | sort | uniq)\"`\n\nThen see if you can pull them:\n\n`while IFS= read -r img; do docker pull \"$img\" || echo \"Failed to pull $img\"; sleep 1; docker rmi \"$img\"; sleep 2; done <<< $images`",
        "mode": "markdown"
      },
      "pluginVersion": "7.5.4",
      "targets": [
        {
          "queryType": "randomWalk",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "type": "text"
    }
  ],
  "schemaVersion": 27,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": []
  },
  "time": {
    "from": "now-7d",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "Kubernetes Pre-Deployment Checks",
  "uid": "ELEeMWK7z",
  "version": 5,
  "description": "Check your workload health before doing modifications to your cluster"
}