Interview Prep/Monitoring & Observability/Grafana, Dashboards and Kubernetes Monitoring

Alert when a Deployment has fewer available replicas than desired for 15 minutes.

BeginnerScenarioGrafana, Dashboards and Kubernetes Monitoring
Answer

Situation read → Uses kube-state-metrics.

What I'd do →

- alert: DeploymentReplicasMismatch
  expr: |
    kube_deployment_spec_replicas{namespace="prod"}
      != kube_deployment_status_replicas_available{namespace="prod"}
  for: 15m
  labels: {severity: ticket}
  annotations:
    summary: "{{ $labels.namespace }}/{{ $labels.deployment }} has unavailable replicas"
  1. Use for: 15m to allow rollouts to finish.
  2. Combine with an HPA check so scaling events do not trigger it falsely.

Why → Catches stuck rollouts, crash loops and scheduling failures.

Interview tip → Mention that kube-prometheus-stack already ships KubeDeploymentReplicasMismatch.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Grafana, Dashboards and Kubernetes Monitoring