Русская версия

KubeDeploymentReplicasMismatch: what to do when it fires

Alert rule

alert: KubeDeploymentReplicasMismatch
expr: kube_deployment_spec_replicas
  != kube_deployment_status_replicas_available
for: 15m
severity: warning

Alert message: Deployment {{ $labels.namespace }}/{{ $labels.deployment }}: replica count differs from desired

What it means

The number of available replicas of a Deployment has differed from the desired number for 15 minutes. Usually fewer are available; a surplus can occur during scaling.

Common causes

A failed rollout in progress (the new version does not start), a Pod failing its readiness probe, a shortage of resources, a removed node.

Diagnostics

kubectl -n <ns> get deploy <name>
kubectl -n <ns> rollout status deployment/<name>
kubectl -n <ns> describe deploy <name>
kubectl -n <ns> get pods -l <selector-labels> -o wide
kubectl -n <ns> describe pod <problem-pod>

How to fix

Fix the cause of the unhealthy Pods (see KubePodCrashLooping, KubePodNotReady). If the new version is broken, roll back: kubectl -n <ns> rollout undo deployment/<name>.

When it is OK to silence

When replicas have been deliberately set to zero (replicas: 0) for maintenance.

Related alerts

The full pack of 44 tested rules + Alertmanager → Telegram: 790 ₽ (≈ $9, card payment in rubles)
Open in Telegram · Free Monitoring Lite kit · All runbook alerts