> ## Documentation Index
> Fetch the complete documentation index at: https://inframan.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Self-healing

> How Inframan keeps the platform it runs for you healthy: it reads alerts, finds the root cause, raises limits, reconciles drift, and calls a person only when that fails.

Inframan runs a set of platform components in every infrastructure: the ingress gateway, cert-manager, Knative and the monitoring stack. It also keeps them healthy for you. When one of them runs out of memory, is starved of CPU, or drifts from its configuration, Inframan fixes it in place and redeploys it, without waiting for a person.

## How it works

```mermaid theme={null}
flowchart LR
  A[AlertManager fires] --> B[Inframan records the incident]
  B --> C[Find the root cause]
  C --> D{Fixed recently?}
  D -- No --> E[Apply the fix and redeploy]
  D -- Yes --> F[Alert a person]
```

1. The cluster's AlertManager sends the alert to Inframan as soon as it fires. Alerts that arrive together are handled together, one component at a time.
2. Inframan works out the **root cause** before acting. A component that keeps crashing because it runs out of memory needs more memory, not a restart, so a crash loop that follows an out-of-memory kill in the last 15 minutes is treated as a memory problem.
3. If the component has drifted from its configuration, that's fixed first.
4. Otherwise Inframan applies the fix and redeploys the component. A deploy that's stuck on the broken component is interrupted, rolled back and retried with the new settings.

## What it fixes

| Problem | Fix |
| - | - |
| Out of memory | Raise the memory limit by one step, up to a ceiling |
| CPU throttled more than half the time | Raise the CPU limit by one step, up to a ceiling |
| Crash loop | Redeploy the component, or raise its memory if it was recently killed for memory |
| Image can't be pulled, or too few replicas | Redeploy the component |

The request is raised with the limit, to half the new limit.

### Ceilings

| Component | Memory ceiling | CPU ceiling |
| - | - | - |
| Prometheus | 4 GiB | 2 CPU |
| Loki, Tempo | 2 GiB | 1 CPU |
| Prometheus operator | 1 GiB | 500m |
| Alloy | 512 MiB | 500m |
| `istiod`, ingress gateway | 2 GiB | 2 CPU |
| cert-manager | 1 GiB | 500m |
| cert-manager webhook | 512 MiB | 500m |
| Knative operator | 1 GiB | 500m |
| Knative activator | 1 GiB | 1 CPU |
| Knative controller, webhook and autoscaler | 512 MiB | 500m |

Because the monitoring stack can't alert about itself when it's down, Inframan also watches the stack's own pods directly.

## When a person is needed

If the same fix is needed again within an hour, Inframan stops and raises a **platform alert** in the notification bell instead of trying again. Automation for that component pauses so it never fights a person working on it.

When you've dealt with it, click **Acknowledge** to hand the component back to automation.

Infrastructures that are asleep don't act on alerts. See [Business hours](https://inframan.mintlify.site/optimize/business-hours.md).

## Your own services

Self-healing changes only the platform's components. Your services keep the resources you set in `inframan.yaml`, so a change to them is always one you made. What protects your services:

* Kubernetes restarts a container that crashes or fails its liveness probe.
* [Autoscaling](https://inframan.mintlify.site/optimize/autoscaling.md) adds replicas under load.
* A release that fails keeps traffic on the previous revision and raises a platform alert. See [Revisions and traffic](https://inframan.mintlify.site/deploy/revisions.md).
* The **Alerts** view shows when a service is running out of memory or crashing, so you can raise its limits.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.