# Self-hosted gateway maintenance

> Keep gateway replicas available during node maintenance and set connection drain times.

This guide covers node maintenance and connection drain settings for the enterprise gateway chart.

## Keep replicas available

The enterprise chart creates a PodDisruptionBudget for the backplane. It permits one voluntary eviction at a time. Run at least two replicas to keep a ready replica during maintenance. A single replica can still be evicted.

Set the budget in your Helm values:

```yaml
backplaneDisruptionBudget:
  enabled: true
  maxUnavailable: 1
```

The budget applies to node drains that use the Kubernetes eviction API. It does not stop direct pod deletion, process crashes, node failure, or a Deployment update. Configure the Deployment update strategy separately.

A drain can stop when no replacement pod can become Ready. Provide capacity on another node before you drain a node. Set `backplaneDisruptionBudget.enabled` to `false` only when your maintenance procedure permits concurrent evictions.

## Set connection drain times

Set both the Proxy shutdown configuration and the chart's pod grace period:

```yaml
apiVersion: core.apoxy.dev/v1alpha2
kind: Proxy
metadata:
  name: default
spec:
  provider: unmanaged
  shutdown:
    drainTimeout: 30s
    minimumDrainTime: 1s
```

Use the same drain timeout in your Helm values:

```yaml
apoxy-gateway:
  backplane:
    proxy:
      drainTimeoutSeconds: 30
```

The chart adds five seconds to this value for `terminationGracePeriodSeconds`. The Proxy controls connection draining. The chart controls when Kubernetes forcibly stops the container. A Proxy edit does not update the pod grace period.

## Verify

Read the budget and pod grace periods in your gateway namespace:

```bash
kubectl --context <kube-context> -n <namespace> get pdb
kubectl --context <kube-context> -n <namespace> get pods \
  -l app.kubernetes.io/component=backplane \
  -o custom-columns=NAME:.metadata.name,GRACE:.spec.terminationGracePeriodSeconds
```

You should see one permitted disruption when all replicas are Ready, and a grace period of 35 seconds for the example configuration.

---

**Navigation** (Guides)

- Previous: [Query logs with Claude Code](/docs/guides/mcp-claude-code.md)
- Next: [Troubleshooting](/docs/guides/troubleshooting.md)
- All pages: [index](/docs/llms.txt)
