# Monitor and troubleshoot Pulse on Kubernetes

Check all three pods. A successful request through `pulse-client` reaches a ready endpoint and can hide a failing voter. The HTTP listener exposes `/healthz`, `/readyz`, and `/metrics` without credentials inside your private network.

## Inspect each voter

```sh
kubectl -n pulse get pods -o wide
kubectl -n pulse get endpointslices -l kubernetes.io/service-name=pulse-client
for pod in pulse-0 pulse-1 pulse-2; do
  echo "$pod"
  kubectl -n pulse exec "$pod" -- curl -fsS http://localhost:9070/readyz
done
kubectl -n pulse exec pulse-0 -- curl -fsS http://localhost:9070/metrics
```

`/healthz` checks the process. `/readyz` checks that the voter can reach quorum-confirmed leaders for every group and that it caught up after starting. A pod can be alive and still be catching up. Inspect its readiness response and logs before restarting another voter.

## Configure one Prometheus collector

Check which monitoring resources your platform provides. Choose one collector for this release and merge its example with your existing values. Keep any existing `networkPolicy.clientsFrom` entries. Substitute the real collector namespace, and for Prometheus Operator match the labels and namespace selector of your Prometheus installation.

```sh
kubectl api-resources --api-group=monitoring.coreos.com
kubectl api-resources --api-group=monitoring.googleapis.com
```

**Prometheus Operator** watches a `PodMonitor`. The example assumes Prometheus runs in namespace `monitoring` and selects PodMonitors labeled `release: kube-prometheus-stack`.

```yaml
metrics:
  interval: 30s
  podMonitor:
    enabled: true
    labels:
      release: kube-prometheus-stack
networkPolicy:
  enabled: true
  metricsFrom:
    - namespaceSelector:
        matchLabels:
          kubernetes.io/metadata.name: monitoring
```

**Google Cloud Managed Service for Prometheus** uses a namespaced `PodMonitoring`. This example assumes managed collection is enabled and its collectors run in `gmp-system`.

```yaml
metrics:
  interval: 30s
  podMonitoring:
    enabled: true
networkPolicy:
  enabled: true
  metricsFrom:
    - namespaceSelector:
        matchLabels:
          kubernetes.io/metadata.name: gmp-system
```

Apply the values with the [Helm upgrade procedure](/smts/docs/kubernetes/operations/). Inspect `kubectl -n pulse get podmonitor pulse` or `kubectl -n pulse get podmonitoring pulse`, whichever you selected. Both scrape each matching pod on the named `http` port at `/metrics`. In your collector’s target view, verify **three healthy pod targets**. Confirm a fresh sample for each pod in the query view. An accepted Kubernetes resource alone does not verify scraping.

## First dashboard and alerts

Scope queries to this cluster and release using the labels your collector actually adds. These examples assume the namespace label is `namespace="pulse"` and the queries select a single cluster. A five-minute alert duration is a starting point for transient elections and scrapes. Alert separately for missing series or targets.

| Signal | PromQL or source | What to investigate |
| --- | --- | --- |
| Ready replicas | `kube_statefulset_status_replicas_ready{namespace="pulse",statefulset="pulse"}` | Expected 3 at the initial size. If fewer, check pod events, PVCs and readiness. Requires kube-state-metrics. |
| Leaders | `sum by (kind, shard) (pulse_group_leader{namespace="pulse"})` | Expect 1 for each metadata and data group once elections settle. Check missing targets before diagnosing quorum. |
| Unhealthy groups | `max by (kind, shard) (pulse_group_unhealthy{namespace="pulse"})` | A value of 1 calls for inspecting voter logs, retained log health, and maintenance errors. |
| Segment capacity | `max by (shard) (pulse_group_segment_bytes{namespace="pulse",kind="Data"} / pulse_group_segment_limit_bytes{namespace="pulse",kind="Data"})` | Watch the fullest replica of each data shard. Investigate a rising ratio above 0.8 and compare with actual PVC free space. |
| Rejected proposals | `increase(pulse_group_rejected_proposals_total{namespace="pulse"}[5m])` | Compare sustained increases with write errors, disk latency, and the affected shard’s budgets. |
| Replica progress | `pulse_group_applied_index{namespace="pulse",kind="Data"}` | Compare voters for the same shard. A growing gap under active writes warrants investigation. |

Replica counters can describe the same committed work three times. Use application receipts or query the logical table to count customer rows. Supplement these metrics with client write/query latency, pod restarts, PVC space, and backup job outcomes.

## Triage common failures

| Symptom | First check |
| --- | --- |
| `ImagePullBackOff` | Describe the pod. Check the published image tag, pod events and Docker Hub connectivity from the worker. |
| Pod stays Pending | Check scheduling events, worker count, zone constraints, StorageClass, and PVC binding. |
| Pod stays unready | Inspect `kubectl -n pulse logs POD` and `/readyz` on that pod. Wait for catch-up before draining another node. |
| Metrics endpoint works but targets are missing | Check the monitoring CRD, collector’s selectors, pod labels, namespace discovery, and NetworkPolicy. |
| Volume is empty for a previously provisioned voter | Preserve the PVC and `pulse-state` for investigation. Follow the [recovery guide](/smts/docs/kubernetes/operations/). |

## License monitoring

Scrape `pulse_license_state` and `pulse_license_load_error` on every voter. Compare `pulse_license_usage` with `pulse_license_limit` by limit name, and alert when `pulse_license_refusals_total` increases. During renewal, confirm all three voters report the expected license ID and expiry through authenticated `GET /license`. [Owner setup and renewal](/smts/docs/kubernetes/install/)
