Files

5.8 KiB

Alerts and Incident Response

Alertmanager: configured in monitoring/alertmanager-config.yaml
Receivers:

  • Email → garfield@squaremcp.com via Azure Comm Services (smtp.azurecomm.net:587)
  • Slack → #alerts via existing webhook

Current alert routing

Alert Severity Route Action
Default alerts critical/warning Slack #alerts + email Page/notify
InfoInhibitor info null Suppressed
Watchdog none null Heartbeat, no notification

Alerts to pay attention to

Website down

Likely cause: certificate expiry, DNS issue, ingress misconfig, service crash, host/network outage.

PromQL: probe_success{job="blackbox-http"} == 0

Response:

  1. Check probe_duration_seconds to see if it is a timeout vs. connection refused.
  2. Test manually: curl -I https://<site>.
  3. Check ingress: microk8s kubectl get ingress -A and microk8s kubectl get pods -n ingress.
  4. Check the backing pod logs: microk8s kubectl logs -n <namespace> -l app=<app> --insecure-skip-tls-verify-backend=true.
  5. Check SSL expiry: (probe_ssl_earliest_cert_expiry - time()) / 86400.

MySQL down

PromQL: up{job="mysql"} == 0 or mysql_up == 0

Response:

  1. MySQL runs as a Docker container on the host at :3306.
  2. Check container: docker ps | grep mysql or ss -tlnp | grep 3306.
  3. If stopped, restart from the fetcherpay_mysql_data volume (see previous deployment notes).
  4. Check mysql-exporter pod: microk8s kubectl get pods -n fetcherpay -l app=mysql-exporter.

Redis down

PromQL: up{job="redis"} == 0 or redis_up == 0

Response:

  1. Check Redis pod: microk8s kubectl get pods -n fetcherpay -l app=redis.
  2. Check logs: microk8s kubectl logs -n fetcherpay -l app=redis --insecure-skip-tls-verify-backend=true.
  3. Verify exporter: microk8s kubectl get pods -n fetcherpay -l app=redis-exporter.

Prometheus down

PromQL: up{job="prometheus"} == 0

Response:

  1. Check pod: microk8s kubectl get pods -n fetcherpay -l app=prometheus.
  2. Check logs; common issue is invalid config.
  3. If ConfigMap changed, restart: microk8s kubectl rollout restart deployment/prometheus -n fetcherpay.

OTel collector down

PromQL: up{job="otel-collector"} == 0 or absent otelcol_process_uptime_total

Response:

  1. Check pod: microk8s kubectl get pods -n observability -l app=otel-collector.
  2. Common failure: invalid YAML config. Fix and reapply monitoring/opentelemetry-collector.yaml.
  3. Restart: microk8s kubectl rollout restart deployment/otel-collector -n observability.

High container restart rate

PromQL: rate(kube_pod_container_status_restarts_total[5m]) > 0.01

Response:

  1. Identify pod/namespace from labels.
  2. Check events: microk8s kubectl describe pod -n <ns> <pod>.
  3. Check logs (with TLS skip flag if needed).
  4. Investigate resource limits, OOM, liveness probe failures.

Node CPU / memory / disk high

PromQL:

  • CPU: 100 - (avg by (instance) (irate(node_cpu_seconds_total{mode="idle"}[5m])) * 100) > 85
  • Memory: 100 * (1 - (node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes)) > 85
  • Disk: 100 - ((node_filesystem_avail_bytes{mountpoint="/"} * 100) / node_filesystem_size_bytes{mountpoint="/"}) > 85

Response:

  1. Identify which pod/container is consuming resources via K8s Prometheus.
  2. Scale, restart, or optimize the offending workload.
  3. For disk: clean logs, old images (docker system prune -a), or expand storage.

SSL certificate expiring

PromQL: (probe_ssl_earliest_cert_expiry{job="blackbox-http"} - time()) / 86400 < 14

Response:

  1. Renew the cert (likely cert-manager handles this).
  2. Check cert-manager: microk8s kubectl get certificates -A.
  3. Force renewal if stuck.

Pre-existing issues that will trigger alerts

These are already unhealthy and will show red in dashboards. They are not caused by recent deployments.

fetcherpay-leads-api / fetcherpay-leads-worker ImagePullBackOff

Why: stale image references to dead registry 23.120.207.35:32000. Current registry is localhost:32000, and tag v16-import-fix does not exist.

Fix options:

  1. Update Deployments to use localhost:32000/fetcherpay/leads-api:latest.
  2. Delete the Deployments if the leads feature is abandoned.

nginx-ingress-microk8s-controller restarts

Why: chronic single-node instability (~1 restart/day over 9 months). Likely OOM, liveness timeouts, or containerd sandbox churn.

Mitigation:

  • Add memory request/limit to the ingress DaemonSet.
  • Monitor kube_pod_container_status_restarts_total{namespace="ingress"}.
  • Check dmesg / kernel OOM logs if restarts spike.

How to add a new alert rule

  1. Edit the Prometheus ConfigMap or kube-prometheus-stack PrometheusRule CRDs.
  2. For FetcherPay Prometheus, add a rule_files section or use recording_rules/alerting_rules in monitoring/prometheus-config.yaml.
  3. Apply and restart Prometheus.
  4. Verify in Alertmanager: https://dashboard.fetcherpay.com/alerting/ or API.

Example simple rule:

groups:
  - name: fetcherpay
    rules:
      - alert: WebsiteDown
        expr: probe_success{job="blackbox-http"} == 0
        for: 2m
        labels:
          severity: critical
        annotations:
          summary: "Website {{ $labels.instance }} is down"

Runbook quick-decision tree

ALERT fires
  │
  ├─ Is it a website? → check probe_success, curl manually, check ingress
  ├─ Is it MySQL/Redis/Prometheus/OTel? → check pod status, restart if needed
  ├─ Is it a pod restart spike? → describe pod, check OOM/probes
  ├─ Is it node resource pressure? → identify top consumer, scale/restart
  └─ Is it a known pre-existing issue? → document, do not page unless it worsens