@leverege/build-tools 2.66.0 → 2.66.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/package.json +2 -2
  2. package/src/bash-funcs +1 -0
  3. package/src/helm-charts/cnpg-db-pgbench/cluster.yaml.ovh +2 -0
  4. package/src/helm-charts/cnpg-db-tsdb-basic/cluster.yaml.ovh +3 -1
  5. package/src/helm-charts/cnpg-db-tsdb-dense/cluster.yaml.ovh +2 -0
  6. package/src/helm-charts/elasticsearch8/helmup.plugin +1 -1
  7. package/src/helm-charts/prom-operator/prometheus-stack.yaml.ovh +2 -2
  8. package/src/helm-charts/prom-operator/rules/awesome-base/elasticsearch-rules.yaml +219 -0
  9. package/src/helm-charts/prom-operator/rules/awesome-base/google-cadvisor.yaml +108 -0
  10. package/src/helm-charts/prom-operator/rules/{new-awesome.yaml → awesome-base/kubestate-exporter.yaml} +2 -1
  11. package/src/helm-charts/prom-operator/rules/awesome-base/prometheus-rules.yaml +318 -0
  12. package/src/helm-charts/prom-operator/rules/awesome-base/redis-rules.yaml +142 -0
  13. package/src/helm-charts/prom-operator/rules/awesome-base/traefik-rules.yaml +43 -0
  14. package/src/helm-charts/prom-operator/rules/cadvisor-rules.yaml +109 -0
  15. package/src/helm-charts/prom-operator/rules/cnpg-rules.yaml +3 -2
  16. package/src/helm-charts/prom-operator/rules/elasticsearch-rules.yaml +212 -94
  17. package/src/helm-charts/prom-operator/rules/gcp-rules.yaml +2 -2
  18. package/src/helm-charts/prom-operator/rules/kubestate-rules.yaml +412 -0
  19. package/src/helm-charts/prom-operator/rules/po-k8s-selective.yaml +23 -0
  20. package/src/helm-charts/prom-operator/rules/prometheus-rules.yaml +312 -73
  21. package/src/helm-charts/prom-operator/rules/redis-rules.yaml +135 -74
  22. package/src/helm-charts/prom-operator/rules/traefik-rules.yaml +47 -20
  23. package/src/helm-charts/prom-operator/update-rules.sh +32 -0
  24. package/src/helm-charts/redis/helmup.plugin +1 -1
  25. package/src/helm-charts/velero/helmup.plugin +1 -1
  26. package/src/helmup.sh +2 -2
  27. package/src/awesome-fetch.mjs +0 -44
  28. package/src/helm-charts/prom-operator/apply-rules +0 -15
  29. package/src/helm-charts/prom-operator/gitignore +0 -2
  30. package/src/helm-charts/prom-operator/rules/awesome-k8s.yaml +0 -326
  31. package/src/helm-charts/prom-operator/rules/kubernetes-rules.yaml +0 -109
  32. /package/src/helm-charts/prom-operator/rules/{postgres-rules.yaml → postgres-rules.yaml.disabled} +0 -0
@@ -1,27 +1,54 @@
1
+ # https://samber.github.io/awesome-prometheus-alerts/rules#traefik
1
2
  apiVersion: monitoring.coreos.com/v1
2
3
  kind: PrometheusRule
3
4
  metadata:
4
5
  name: traefik-rules
5
6
  namespace: prometheus
6
-
7
7
  spec:
8
8
  groups:
9
- - name: Traefik Alerts
10
- rules:
11
- - alert: TraefikConfigReloadFailed
12
- expr: traefik_config_last_reload_failure > 0
13
- for: 1m
14
- labels:
15
- severity: warning
16
- annotations:
17
- summary: "Traefik config failed to reload"
18
- description: "New config file for Traefik is invalid or Traefik encountered an error"
19
-
20
- # - alert: TraefikHighHttp4xxError
21
- # expr: sum(rate(traefik_service_requests_total{code=~"4.*"}[3m])) by (service) / sum(rate(traefik_service_requests_total[3m])) by (service) * 100 > 10
22
- # for: 5m
23
- # labels:
24
- # severity: error
25
- # annotations:
26
- # summary: "Traefik high HTTP 4xx error rate on {{ $labels.service }}"
27
- # description: "Traefik backend 4xx error rate is above 10% (currently at {{ $value }}%)"
9
+ - name: Traefik (awesome) # EmbeddedExporterV2-rules
10
+ rules:
11
+ - alert: TraefikServiceDown
12
+ expr: count(traefik_service_server_up) by (service) == 0
13
+ for: 0m
14
+ labels:
15
+ severity: critical
16
+ annotations:
17
+ summary: Traefik service down (instance {{ $labels.instance }})
18
+ description: |-
19
+ All Traefik services are down
20
+ VALUE = {{ $value }}
21
+ LABELS = {{ $labels }}
22
+ # - alert: TraefikHighHttp4xxErrorRateService
23
+ # expr: sum(rate(traefik_service_requests_total{code=~"4.*"}[3m])) by (service) / sum(rate(traefik_service_requests_total[3m])) by (service) * 100 > 5
24
+ # for: 1m
25
+ # labels:
26
+ # severity: critical
27
+ # annotations:
28
+ # summary: Traefik high HTTP 4xx error rate service (instance {{ $labels.instance }})
29
+ # description: |-
30
+ # Traefik service 4xx error rate is above 5%
31
+ # VALUE = {{ $value }}
32
+ # LABELS = {{ $labels }}
33
+ - alert: TraefikHighHttp5xxErrorRateService
34
+ expr: sum(rate(traefik_service_requests_total{code=~"5.*"}[3m])) by (service) / sum(rate(traefik_service_requests_total[3m])) by (service) * 100 > 5
35
+ for: 1m
36
+ labels:
37
+ severity: critical
38
+ annotations:
39
+ summary: Traefik high HTTP 5xx error rate service (instance {{ $labels.instance }})
40
+ description: |-
41
+ Traefik service 5xx error rate is above 5%
42
+ VALUE = {{ $value }}
43
+ LABELS = {{ $labels }}
44
+ #
45
+ # legacy leverege alert
46
+ #
47
+ - alert: TraefikConfigReloadFailed
48
+ expr: traefik_config_last_reload_failure > 0
49
+ for: 1m
50
+ labels:
51
+ severity: warning
52
+ annotations:
53
+ summary: "Traefik config failed to reload"
54
+ description: "New config file for Traefik is invalid or Traefik encountered an error"
@@ -0,0 +1,32 @@
1
+ #!/bin/bash
2
+ #
3
+ # Load the standard helper functions
4
+ . `build-tools --bashfun`
5
+
6
+ RULES_DIR="$GITTOP/prom-operator/rules"
7
+ [ ! -d "$RULES_DIR" ] && errorExit "Missing rules directory [$RULES_DIR]"
8
+
9
+ case "$1" in
10
+ "apply"|"delete")
11
+ cd $GITTOP
12
+ overwhelm
13
+ for ruleset in $RULES_DIR/*.yaml; do
14
+ shortName=`basename $ruleset`
15
+ printf "\n $1 rules => `color g $shortName`\n"
16
+ kubectl $1 -n prometheus -f $ruleset
17
+ done
18
+ echo "" && kubectl get -A prometheusrules.monitoring.coreos.com
19
+ ;;
20
+
21
+ *)
22
+ cat<<USAGE_HELP
23
+
24
+ Usage: $0 [apply|delete]
25
+
26
+ This will either apply or delete the rules defined in $RULES_DIR
27
+
28
+ USAGE_HELP
29
+
30
+ exit 1
31
+ ;;
32
+ esac
@@ -4,7 +4,7 @@ showInstalling "Redis"
4
4
 
5
5
  OCI_CHART="oci://registry-1.docker.io/bitnamicharts/redis"
6
6
 
7
- [ -z "$REDIS_CHART_VERSION" ] && REDIS_CHART_VERSION="20.11.5"
7
+ [ -z "$REDIS_CHART_VERSION" ] && REDIS_CHART_VERSION="20.12.1"
8
8
 
9
9
  helm upgrade --install redis $OCI_CHART \
10
10
  --values redis/values.yaml \
@@ -4,7 +4,7 @@ showInstalling "Velero Backup System"
4
4
 
5
5
  addHelmRepo vmware-tanzu https://vmware-tanzu.github.io/helm-charts
6
6
 
7
- [ -z "$VELERO_CHART_VERSION" ] && VELERO_CHART_VERSION="8"
7
+ [ -z "$VELERO_CHART_VERSION" ] && VELERO_CHART_VERSION="9"
8
8
  #
9
9
  # Build the bucket, region and SA email variables and use --set to mod the
10
10
  # chart values as opposed to using an OVH:<label> approach. This eliminates
package/src/helmup.sh CHANGED
@@ -696,7 +696,7 @@ kind: VolumeSnapshotClass
696
696
  metadata:
697
697
  name: cnpg-snapshotclass
698
698
  driver: pd.csi.storage.gke.io
699
- deletionPolicy: Delete
699
+ deletionPolicy: Retain
700
700
  EOSNAPSC
701
701
 
702
702
  sleep 2 # hold up processing for a moment to allow IAM mods to propagate
@@ -791,7 +791,7 @@ function installVeleroEnvironment() {
791
791
  gcloud config set project $GCP_PROJECT_ID
792
792
 
793
793
  ## The major chart version will determine the bucket suffix
794
- [ -z "$VELERO_CHART_VERSION" ] && VELERO_CHART_VERSION="8"
794
+ [ -z "$VELERO_CHART_VERSION" ] && VELERO_CHART_VERSION="9"
795
795
 
796
796
  ## Create a bucket
797
797
  BUCKET="$GCP_PROJECT_ID-velero-$VELERO_CHART_VERSION"
@@ -1,44 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import fs from 'node:fs'
4
- import yaml from 'js-yaml'
5
-
6
- const SOURCE_URL = 'https://raw.githubusercontent.com/samber/awesome-prometheus-alerts/master/dist/rules/kubernetes/kubestate-exporter.yml'
7
- const OUTPUT_FILE = 'converted-alerts.yaml'
8
-
9
- async function fetchAndConvert() {
10
- /* eslint-disable no-console */
11
- try {
12
- console.log( `Fetching YAML from ${SOURCE_URL}...` )
13
- const response = await fetch( SOURCE_URL )
14
- if ( !response.ok ) throw new Error( `Failed to fetch: ${response.statusText}` )
15
-
16
- const rawYaml = await response.text()
17
- const parsedYaml = yaml.load( rawYaml )
18
- if ( !parsedYaml.groups ) throw new Error( 'Invalid YAML structure, missing "groups"' )
19
-
20
- // Reformat into PrometheusRule CRD format
21
- const prometheusRule = {
22
- apiVersion : 'monitoring.coreos.com/v1',
23
- kind : 'PrometheusRule',
24
- metadata : {
25
- name : 'node-alerts', // Adjust based on the source
26
- },
27
- spec : {
28
- groups : parsedYaml.groups.map( group => ( {
29
- name : `${group.name}-rules`,
30
- rules : group.rules,
31
- } ) ),
32
- },
33
- }
34
-
35
- // Convert back to YAML with proper formatting
36
- const formattedYaml = yaml.dump( prometheusRule, { noRefs : true, indent : 0 } )
37
- fs.writeFileSync( OUTPUT_FILE, formattedYaml, 'utf8' )
38
- console.log( `Converted YAML written to ${OUTPUT_FILE}` )
39
- } catch ( error ) {
40
- console.error( 'Error processing YAML:', error.message )
41
- }
42
- }
43
-
44
- fetchAndConvert()
@@ -1,15 +0,0 @@
1
- #!/bin/bash
2
- #
3
- # Load the standard helper functions
4
- . `build-tools --bashfun`
5
-
6
- overwhelm
7
-
8
- RULES_DIR="prom-operator/rules"
9
-
10
- [ ! -d "$RULES_DIR" ] && errorExit "Missing rules directory [$RULES_DIR]"
11
-
12
- for ruleset in $RULES_DIR/*.yaml; do
13
- printf " Applying rules => `color g $ruleset`\n"
14
- kubectl apply -n prometheus -f $ruleset
15
- done
@@ -1,2 +0,0 @@
1
- prometheus-stack.yaml
2
- stackdriver-exporter.yaml
@@ -1,326 +0,0 @@
1
- # https://samber.github.io/awesome-prometheus-alerts/rules#kubernetes
2
- apiVersion: monitoring.coreos.com/v1
3
- kind: PrometheusRule
4
- metadata:
5
- name: awesome-k8s-rules
6
- namespace: prometheus
7
-
8
- spec:
9
- groups:
10
- - name: Awesome Kubernetes
11
- rules:
12
- - alert: KubernetesNodeNotReady
13
- expr: kube_node_status_condition{condition="Ready",status="true"} == 0
14
- for: 10m
15
- labels:
16
- severity: critical
17
- annotations:
18
- summary: Kubernetes Node not ready (instance {{ $labels.instance }})
19
- description: "Node {{ $labels.node }} has been unready for a long time\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
20
-
21
- - alert: KubernetesNodeMemoryPressure
22
- expr: kube_node_status_condition{condition="MemoryPressure",status="true"} == 1
23
- for: 2m
24
- labels:
25
- severity: critical
26
- annotations:
27
- summary: Kubernetes Node memory pressure (instance {{ $labels.instance }})
28
- description: "Node {{ $labels.node }} has MemoryPressure condition\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
29
-
30
- - alert: KubernetesNodeDiskPressure
31
- expr: kube_node_status_condition{condition="DiskPressure",status="true"} == 1
32
- for: 2m
33
- labels:
34
- severity: critical
35
- annotations:
36
- summary: Kubernetes Node disk pressure (instance {{ $labels.instance }})
37
- description: "Node {{ $labels.node }} has DiskPressure condition\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
38
-
39
- - alert: KubernetesNodeNetworkUnavailable
40
- expr: kube_node_status_condition{condition="NetworkUnavailable",status="true"} == 1
41
- for: 2m
42
- labels:
43
- severity: critical
44
- annotations:
45
- summary: Kubernetes Node network unavailable (instance {{ $labels.instance }})
46
- description: "Node {{ $labels.node }} has NetworkUnavailable condition\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
47
-
48
- - alert: KubernetesNodeOutOfPodCapacity
49
- expr: sum by (node) ((kube_pod_status_phase{phase="Running"} == 1) + on(uid, instance) group_left(node) (0 * kube_pod_info{pod_template_hash=""})) / sum by (node) (kube_node_status_allocatable{resource="pods"}) * 100 > 90
50
- for: 2m
51
- labels:
52
- severity: warning
53
- annotations:
54
- summary: Kubernetes Node out of pod capacity (instance {{ $labels.instance }})
55
- description: "Node {{ $labels.node }} is out of pod capacity\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
56
-
57
- # - alert: KubernetesContainerOomKiller
58
- # expr: (kube_pod_container_status_restarts_total - kube_pod_container_status_restarts_total offset 10m >= 1) and ignoring (reason) min_over_time(kube_pod_container_status_last_terminated_reason{reason="OOMKilled"}[10m]) == 1
59
- # for: 0m
60
- # labels:
61
- # severity: warning
62
- # annotations:
63
- # summary: Kubernetes Container oom killer (instance {{ $labels.instance }})
64
- # description: "Container {{ $labels.container }} in pod {{ $labels.namespace }}/{{ $labels.pod }} has been OOMKilled {{ $value }} times in the last 10 minutes.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
65
-
66
- - alert: KubernetesJobFailed
67
- expr: kube_job_status_failed > 0
68
- for: 0m
69
- labels:
70
- severity: warning
71
- annotations:
72
- summary: Kubernetes Job failed (instance {{ $labels.instance }})
73
- description: "Job {{ $labels.namespace }}/{{ $labels.job_name }} failed to complete\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
74
-
75
- - alert: KubernetesJobNotStarting
76
- expr: kube_job_status_active == 0 and kube_job_status_failed == 0 and kube_job_status_succeeded == 0 and (time() - kube_job_status_start_time) > 600
77
- for: 0m
78
- labels:
79
- severity: warning
80
- annotations:
81
- summary: Kubernetes Job not starting (instance {{ $labels.instance }})
82
- description: "Job {{ $labels.namespace }}/{{ $labels.job_name }} did not start for 10 minutes\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
83
-
84
- - alert: KubernetesCronjobSuspended
85
- expr: kube_cronjob_spec_suspend != 0
86
- for: 0m
87
- labels:
88
- severity: warning
89
- annotations:
90
- summary: Kubernetes CronJob suspended (instance {{ $labels.instance }})
91
- description: "CronJob {{ $labels.namespace }}/{{ $labels.cronjob }} is suspended\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
92
-
93
- - alert: KubernetesPersistentvolumeclaimPending
94
- expr: kube_persistentvolumeclaim_status_phase{phase="Pending"} == 1
95
- for: 2m
96
- labels:
97
- severity: warning
98
- annotations:
99
- summary: Kubernetes PersistentVolumeClaim pending (instance {{ $labels.instance }})
100
- description: "PersistentVolumeClaim {{ $labels.namespace }}/{{ $labels.persistentvolumeclaim }} is pending\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
101
-
102
- - alert: KubernetesVolumeOutOfDiskSpace
103
- expr: kubelet_volume_stats_available_bytes / kubelet_volume_stats_capacity_bytes * 100 < 10
104
- for: 2m
105
- labels:
106
- severity: warning
107
- annotations:
108
- summary: Kubernetes Volume out of disk space (instance {{ $labels.instance }})
109
- description: "Volume is almost full (< 10% left)\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
110
-
111
- # - alert: KubernetesVolumeFullInFourDays
112
- # expr: predict_linear(kubelet_volume_stats_available_bytes[6h:5m], 4 * 24 * 3600) < 0
113
- # for: 0m
114
- # labels:
115
- # severity: critical
116
- # annotations:
117
- # summary: Kubernetes Volume full in four days (instance {{ $labels.instance }})
118
- # description: "Volume under {{ $labels.namespace }}/{{ $labels.persistentvolumeclaim }} is expected to fill up within four days. Currently {{ $value | humanize }}% is available.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
119
-
120
- - alert: KubernetesPersistentvolumeError
121
- expr: kube_persistentvolume_status_phase{phase=~"Failed|Pending", job="kube-state-metrics"} > 0
122
- for: 0m
123
- labels:
124
- severity: critical
125
- annotations:
126
- summary: Kubernetes PersistentVolume error (instance {{ $labels.instance }})
127
- description: "Persistent volume {{ $labels.persistentvolume }} is in bad state\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
128
-
129
- - alert: KubernetesStatefulsetDown
130
- expr: kube_statefulset_replicas != kube_statefulset_status_replicas_ready > 0
131
- for: 1m
132
- labels:
133
- severity: critical
134
- annotations:
135
- summary: Kubernetes StatefulSet down (instance {{ $labels.instance }})
136
- description: "StatefulSet {{ $labels.namespace }}/{{ $labels.statefulset }} went down\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
137
-
138
- # - alert: KubernetesHpaScaleInability
139
- # expr: (kube_horizontalpodautoscaler_spec_max_replicas - kube_horizontalpodautoscaler_status_desired_replicas) * on (horizontalpodautoscaler,namespace) (kube_horizontalpodautoscaler_status_condition{condition="ScalingLimited", status="true"} == 1) == 0
140
- # for: 2m
141
- # labels:
142
- # severity: warning
143
- # annotations:
144
- # summary: Kubernetes HPA scale inability (instance {{ $labels.instance }})
145
- # description: "HPA {{ $labels.namespace }}/{{ $labels.horizontalpodautoscaler }} is unable to scale\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
146
-
147
- - alert: KubernetesHpaMetricsUnavailability
148
- expr: kube_horizontalpodautoscaler_status_condition{status="false", condition="ScalingActive"} == 1
149
- for: 0m
150
- labels:
151
- severity: warning
152
- annotations:
153
- summary: Kubernetes HPA metrics unavailability (instance {{ $labels.instance }})
154
- description: "HPA {{ $labels.namespace }}/{{ $labels.horizontalpodautoscaler }} is unable to collect metrics\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
155
-
156
- # - alert: KubernetesHpaScaleMaximum
157
- # expr: (kube_horizontalpodautoscaler_status_desired_replicas >= kube_horizontalpodautoscaler_spec_max_replicas) and (kube_horizontalpodautoscaler_spec_max_replicas > 1) and (kube_horizontalpodautoscaler_spec_min_replicas != kube_horizontalpodautoscaler_spec_max_replicas)
158
- # for: 2m
159
- # labels:
160
- # severity: info
161
- # annotations:
162
- # summary: Kubernetes HPA scale maximum (instance {{ $labels.instance }})
163
- # description: "HPA {{ $labels.namespace }}/{{ $labels.horizontalpodautoscaler }} has hit maximum number of desired pods\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
164
-
165
- - alert: KubernetesHpaUnderutilized
166
- expr: max(quantile_over_time(0.5, kube_horizontalpodautoscaler_status_desired_replicas[1d]) == kube_horizontalpodautoscaler_spec_min_replicas) by (horizontalpodautoscaler) > 3
167
- for: 0m
168
- labels:
169
- severity: info
170
- annotations:
171
- summary: Kubernetes HPA underutilized (instance {{ $labels.instance }})
172
- description: "HPA {{ $labels.namespace }}/{{ $labels.horizontalpodautoscaler }} is constantly at minimum replicas for 50% of the time. Potential cost saving here.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
173
-
174
- - alert: KubernetesPodNotHealthy
175
- expr: sum by (namespace, pod) (kube_pod_status_phase{phase=~"Pending|Unknown|Failed"}) > 0
176
- for: 15m
177
- labels:
178
- severity: critical
179
- annotations:
180
- summary: Kubernetes Pod not healthy (instance {{ $labels.instance }})
181
- description: "Pod {{ $labels.namespace }}/{{ $labels.pod }} has been in a non-running state for longer than 15 minutes.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
182
-
183
- - alert: KubernetesPodCrashLooping
184
- expr: increase(kube_pod_container_status_restarts_total[1m]) > 3
185
- for: 2m
186
- labels:
187
- severity: warning
188
- annotations:
189
- summary: Kubernetes pod crash looping (instance {{ $labels.instance }})
190
- description: "Pod {{ $labels.namespace }}/{{ $labels.pod }} is crash looping\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
191
-
192
- - alert: KubernetesReplicasetReplicasMismatch
193
- expr: kube_replicaset_spec_replicas != kube_replicaset_status_ready_replicas
194
- for: 10m
195
- labels:
196
- severity: warning
197
- annotations:
198
- summary: Kubernetes ReplicaSet replicas mismatch (instance {{ $labels.instance }})
199
- description: "ReplicaSet {{ $labels.namespace }}/{{ $labels.replicaset }} replicas mismatch\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
200
-
201
- - alert: KubernetesDeploymentReplicasMismatch
202
- expr: kube_deployment_spec_replicas != kube_deployment_status_replicas_available
203
- for: 10m
204
- labels:
205
- severity: warning
206
- annotations:
207
- summary: Kubernetes Deployment replicas mismatch (instance {{ $labels.instance }})
208
- description: "Deployment {{ $labels.namespace }}/{{ $labels.deployment }} replicas mismatch\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
209
-
210
- - alert: KubernetesStatefulsetReplicasMismatch
211
- expr: kube_statefulset_status_replicas_ready != kube_statefulset_status_replicas
212
- for: 10m
213
- labels:
214
- severity: warning
215
- annotations:
216
- summary: Kubernetes StatefulSet replicas mismatch (instance {{ $labels.instance }})
217
- description: "StatefulSet does not match the expected number of replicas.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
218
-
219
- - alert: KubernetesDeploymentGenerationMismatch
220
- expr: kube_deployment_status_observed_generation != kube_deployment_metadata_generation
221
- for: 10m
222
- labels:
223
- severity: critical
224
- annotations:
225
- summary: Kubernetes Deployment generation mismatch (instance {{ $labels.instance }})
226
- description: "Deployment {{ $labels.namespace }}/{{ $labels.deployment }} has failed but has not been rolled back.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
227
-
228
- - alert: KubernetesStatefulsetGenerationMismatch
229
- expr: kube_statefulset_status_observed_generation != kube_statefulset_metadata_generation
230
- for: 10m
231
- labels:
232
- severity: critical
233
- annotations:
234
- summary: Kubernetes StatefulSet generation mismatch (instance {{ $labels.instance }})
235
- description: "StatefulSet {{ $labels.namespace }}/{{ $labels.statefulset }} has failed but has not been rolled back.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
236
-
237
- - alert: KubernetesStatefulsetUpdateNotRolledOut
238
- expr: max without (revision) (kube_statefulset_status_current_revision unless kube_statefulset_status_update_revision) * (kube_statefulset_replicas != kube_statefulset_status_replicas_updated)
239
- for: 10m
240
- labels:
241
- severity: warning
242
- annotations:
243
- summary: Kubernetes StatefulSet update not rolled out (instance {{ $labels.instance }})
244
- description: "StatefulSet {{ $labels.namespace }}/{{ $labels.statefulset }} update has not been rolled out.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
245
-
246
- - alert: KubernetesDaemonsetRolloutStuck
247
- expr: kube_daemonset_status_number_ready / kube_daemonset_status_desired_number_scheduled * 100 < 100 or kube_daemonset_status_desired_number_scheduled - kube_daemonset_status_current_number_scheduled > 0
248
- for: 10m
249
- labels:
250
- severity: warning
251
- annotations:
252
- summary: Kubernetes DaemonSet rollout stuck (instance {{ $labels.instance }})
253
- description: "Some Pods of DaemonSet {{ $labels.namespace }}/{{ $labels.daemonset }} are not scheduled or not ready\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
254
-
255
- - alert: KubernetesDaemonsetMisscheduled
256
- expr: kube_daemonset_status_number_misscheduled > 0
257
- for: 1m
258
- labels:
259
- severity: critical
260
- annotations:
261
- summary: Kubernetes DaemonSet misscheduled (instance {{ $labels.instance }})
262
- description: "Some Pods of DaemonSet {{ $labels.namespace }}/{{ $labels.daemonset }} are running where they are not supposed to run\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
263
-
264
- # Threshold should be customized for each cronjob name.
265
- - alert: KubernetesCronjobTooLong
266
- expr: time() - kube_cronjob_next_schedule_time > 3600
267
- for: 0m
268
- labels:
269
- severity: warning
270
- annotations:
271
- summary: Kubernetes CronJob too long (instance {{ $labels.instance }})
272
- description: "CronJob {{ $labels.namespace }}/{{ $labels.cronjob }} is taking more than 1h to complete.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
273
-
274
- - alert: KubernetesJobSlowCompletion
275
- expr: kube_job_spec_completions - kube_job_status_succeeded - kube_job_status_failed > 0
276
- for: 12h
277
- labels:
278
- severity: critical
279
- annotations:
280
- summary: Kubernetes Job slow completion (instance {{ $labels.instance }})
281
- description: "Kubernetes Job {{ $labels.namespace }}/{{ $labels.job_name }} did not complete in time.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
282
-
283
- - alert: KubernetesApiServerErrors
284
- expr: sum(rate(apiserver_request_total{job="apiserver",code=~"(?:5..)"}[1m])) by (instance, job) / sum(rate(apiserver_request_total{job="apiserver"}[1m])) by (instance, job) * 100 > 3
285
- for: 2m
286
- labels:
287
- severity: critical
288
- annotations:
289
- summary: Kubernetes API server errors (instance {{ $labels.instance }})
290
- description: "Kubernetes API server is experiencing high error rate\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
291
-
292
- - alert: KubernetesApiClientErrors
293
- expr: (sum(rate(rest_client_requests_total{code=~"(4|5).."}[1m])) by (instance, job) / sum(rate(rest_client_requests_total[1m])) by (instance, job)) * 100 > 1
294
- for: 2m
295
- labels:
296
- severity: critical
297
- annotations:
298
- summary: Kubernetes API client errors (instance {{ $labels.instance }})
299
- description: "Kubernetes API client is experiencing high error rate\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
300
-
301
- - alert: KubernetesClientCertificateExpiresNextWeek
302
- expr: apiserver_client_certificate_expiration_seconds_count{job="apiserver"} > 0 and histogram_quantile(0.01, sum by (job, le) (rate(apiserver_client_certificate_expiration_seconds_bucket{job="apiserver"}[5m]))) < 7*24*60*60
303
- for: 0m
304
- labels:
305
- severity: warning
306
- annotations:
307
- summary: Kubernetes client certificate expires next week (instance {{ $labels.instance }})
308
- description: "A client certificate used to authenticate to the apiserver is expiring next week.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
309
-
310
- - alert: KubernetesClientCertificateExpiresSoon
311
- expr: apiserver_client_certificate_expiration_seconds_count{job="apiserver"} > 0 and histogram_quantile(0.01, sum by (job, le) (rate(apiserver_client_certificate_expiration_seconds_bucket{job="apiserver"}[5m]))) < 24*60*60
312
- for: 0m
313
- labels:
314
- severity: critical
315
- annotations:
316
- summary: Kubernetes client certificate expires soon (instance {{ $labels.instance }})
317
- description: "A client certificate used to authenticate to the apiserver is expiring in less than 24.0 hours.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
318
-
319
- - alert: KubernetesApiServerLatency
320
- expr: histogram_quantile(0.99, sum(rate(apiserver_request_duration_seconds_bucket{verb!~"(?:CONNECT|WATCHLIST|WATCH|PROXY)"} [10m])) WITHOUT (subresource)) > 1
321
- for: 2m
322
- labels:
323
- severity: warning
324
- annotations:
325
- summary: Kubernetes API server latency (instance {{ $labels.instance }})
326
- description: "Kubernetes API server has a 99th percentile latency of {{ $value }} seconds for {{ $labels.verb }} {{ $labels.resource }}.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
@@ -1,109 +0,0 @@
1
- apiVersion: monitoring.coreos.com/v1
2
- kind: PrometheusRule
3
- metadata:
4
- name: kubernetes-rules
5
- namespace: prometheus
6
-
7
- spec:
8
- groups:
9
- - name: Kubernetes
10
- rules:
11
- - alert: KubernetesNodeNotReady
12
- expr: kube_node_status_condition{condition="Ready",status="true"} == 0
13
- for: 5m
14
- labels:
15
- severity: page
16
- priority: P3
17
- annotations:
18
- summary: "Kubernetes Node is not ready"
19
- description: "Node {{ $labels.node }} is stuck in unready state for more than 5m"
20
- dashboard: "Check GKE or EKS node status"
21
-
22
- - alert: KubernetesMemoryPressure
23
- expr: kube_node_status_condition{condition="MemoryPressure",status="true"} == 1
24
- for: 5m
25
- labels:
26
- severity: error
27
- annotations:
28
- summary: "Kubernetes memory pressure"
29
- description: "{{ $labels.node }} has a MemoryPressure condition"
30
- dashboard: "Check GKE or EKS node status"
31
-
32
- - alert: KubernetesDiskPressure
33
- expr: kube_node_status_condition{condition="DiskPressure",status="true"} == 1
34
- for: 5m
35
- labels:
36
- severity: error
37
- annotations:
38
- summary: "Kubernetes disk pressure"
39
- description: "{{ $labels.node }} has DiskPressure condition"
40
- dashboard: "Check GKE or EKS node status"
41
-
42
- - alert: KubernetesOutOfDisk
43
- expr: kube_node_status_condition{condition="OutOfDisk",status="true"} == 1
44
- for: 5m
45
- labels:
46
- severity: error
47
- annotations:
48
- summary: "Kubernetes out of disk"
49
- description: "{{ $labels.node }} has is out of disk space"
50
- dashboard: "Check GKE or EKS node status"
51
-
52
- - alert: KubernetesVolumeOutOfDiskSpace
53
- expr: kubelet_volume_stats_available_bytes / kubelet_volume_stats_capacity_bytes * 100 < 10
54
- for: 5m
55
- labels:
56
- severity: error
57
- priority: P2
58
- annotations:
59
- summary: "Kubernetes PVC Free Space < 10%"
60
- description: "PVC volume {{ $labels.persistentvolumeclaim }} is almost full - down to {{ $value | humanize }}% available"
61
-
62
- # - alert: KubernetesVolumeFullInFourDays
63
- # expr: predict_linear(kubelet_volume_stats_available_bytes[6h], 4 * 24 * 3600) < 0
64
- # for: 5m
65
- # labels:
66
- # severity: error
67
- # annotations:
68
- # summary: "Kubernetes Volume full in four days "
69
- # description: "{{ $labels.namespace }}/{{ $labels.persistentvolumeclaim }} is expected to fill up within four days. Currently {{ $value | humanize }}% is available."
70
-
71
- - alert: KubernetesPersistentvolumeError
72
- expr: kube_persistentvolume_status_phase{phase=~"Failed|Pending",job="kube-state-metrics"} > 0
73
- for: 5m
74
- labels:
75
- severity: error
76
- annotations:
77
- summary: "Kubernetes PersistentVolume error "
78
- description: "PersistentVolumeClaim {{ $labels.namespace }}/{{ $labels.persistentvolumeclaim }} is stuck pending"
79
- dashboard: "Check GKE or EKS PVC/storage status"
80
-
81
- - alert: KubernetesHpaScaleCapability
82
- expr: kube_hpa_status_desired_replicas >= kube_hpa_spec_max_replicas
83
- for: 15m
84
- labels:
85
- severity: warning
86
- annotations:
87
- summary: "Kubernetes HPA scale capability"
88
- description: "Kubernetes has scaled {{ $labels.hpa }} to max number of scaled pods."
89
-
90
- - alert: KubernetesPodNotHealthy
91
- expr: kube_pod_status_phase{phase=~"Pending|Unknown|Failed"} == 1
92
- for: 20m
93
- labels:
94
- severity: error
95
- annotations:
96
- summary: "Kubernetes Pod not healthy"
97
- description: "Pod {{ $labels.pod }} has been in a non-ready state for longer than 20 minutes."
98
- dashboard: "Check the pod status using the Kubernetes UI"
99
-
100
- - alert: KubernetesPodCrashLooping
101
- expr: rate(kube_pod_container_status_restarts_total[15m]) * 60 * 5 > 5
102
- for: 5m
103
- labels:
104
- severity: page
105
- priority: P2
106
- annotations:
107
- summary: "Kubernetes pod crash looping"
108
- description: "{{ $labels.pod }} is in a crash loop"
109
- dashboard: "Check the pod status using the Kubernetes UI"