High Availability
HA mode runs several Pilot replicas in one Kubernetes cluster. One replica is active: it monitors Kafka and serves the UI and the API. The others are standbys and do not connect to Kafka. When the active replica fails, a standby takes over and continues the running operations; see Supported actions.
Three replicas on three nodes are the default. More replicas give more standbys, not more capacity. Install HA mode with the Helm chart.
In HA mode, proposals do not move Pilot’s own topics (__pilot_operations,
__pilot_broker_state, __pilot_pat_tokens and AUDIT_TOPIC), or the
__transaction_state partition that Pilot’s own writes use, to improve balance or
leadership. Repairs, for example after a broker loss, still move them.
Supported actions
In HA mode, Pilot runs:
- monitoring, proposals, what-if, previews of drains and redistributions and the other reads, without a license
- applying a proposal, cancelling a running operation and changing its execution limits
- self-healing
- over the REST API, with an
Idempotency-Keyheader: broker maintenance (drains and removals), topic and partition redistributions, bulk partition reassignments, reverting an audited change from the audit log, preferred leader elections, topic configuration changes, client quota changes and deletes, ACL changes, consumer group offset resets and deletes, log directory moves, and the Pilot Agent’s broker restarts, stops and starts, remote upgrades, SSH deploys and rolling restarts with their cancel and the dismissal of a failed or cancelled one’s outcome - the reassignment monitor’s resync and the dry run of a consumer group offset reset
- creating and revoking personal access tokens, changing the agent download URL, creating and revoking agent enrollment tokens, and agent certificate bootstrap
Every other change to Kafka or a Pilot Agent answers 503 HA_UNSUPPORTED. See
Pilot Agent in HA mode for the agent actions
and the rolling restart, and MCP in HA mode for
the MCP tools. Supported actions keep their normal authorization and license
checks, as in standalone mode; cancels need no license. A REST request repeated
under the Idempotency-Key of an accepted request answers its recorded result
also after the license lapsed.
If a REST change finishes quickly, Pilot answers as in standalone mode and adds an
operationId. Otherwise it answers 202 with the operationId. Repeat the
request with the same key to get the result. A repeat never runs the change twice.
Several changes can run beside a data movement (a rebalance, drain, redistribution
or bulk reassignment), but only one leader election at a time.
| Answer | Meaning | What to do |
|---|---|---|
503 HA_NOT_READY | Pilot is starting, recovering or waiting for Kafka; the error text names the reason | Retry later; GET /api/v1/ha shows the mutationReason |
503 HA_NOT_LEADER | The replica is no longer active | Retry |
503 HA_UNCERTAIN | The outcome of an earlier request to Kafka is unknown | See Uncertain requests and external work |
409 HA_BUSY | Pilot is busy, for example 8 changes wait for their answer or another leader election runs | Retry after the Retry-After time |
409 HA_RESOURCE_CONFLICT | A running data movement moves the partition or still uses the topic’s throttle lists | Wait for the data movement to end, or cancel it |
413 HA_PLAN_TOO_LARGE | The request is too large for HA | Split it; see Large operations |
500 HA_OUTCOME_UNKNOWN | Pilot cannot tell whether Kafka applied the change | Check the resource in Kafka before you retry |
The sections below describe further codes where they occur. The API reference lists the answers of each route.
Only a data movement, a leader election and a rolling restart can be cancelled. A
leader election is cancelled by its operation ID. Cancelling all cancels the data
movement and leaves the other changes running. Cancelling another change answers
503 HA_UNSUPPORTED. GET /api/v1/ha lists the other changes under
administrativeOperations; its operationId names the data movement, or the
rolling restart in its place, and operationKind says which.
Components
| Component | Purpose |
|---|---|
| Kubernetes Lease | Picks the active replica |
| Binding ConfigMap | Remembers this installation; back it up |
| Service and EndpointSlice | Route traffic to the active replica |
__pilot_operations | Pilot’s journal: running operations and their history |
__pilot_broker_state | Maintenance and rack state |
__pilot_pat_tokens | Personal access tokens |
__pilot_conditions | The cluster conditions and their 24-hour history, kept over a failover. Not required; see Conditions topic |
No database or extra volume is needed. The chart creates the Lease, the ConfigMap, the Service and the EndpointSlice. Pilot never creates or deletes them. Keep them across upgrades and uninstalls that preserve the installation; see Kept objects.
Requirements and installation
Install HA mode with the Helm chart; see Install. HA needs:
- Kubernetes 1.30 or later, with three worker nodes and room for one extra pod during updates.
- Helm 3.9 or later, or Helm 4.
- Kafka 3.6 or later in KRaft mode, with at least three brokers and three
controllers listed in
controller.quorum.voters. Dynamic KRaft quorums are not supported yet. - Broker settings:
transaction.state.log.replication.factor3 or more,transaction.state.log.min.isr2 or more,unclean.leader.election.enable=falseandtransaction.max.timeout.msat least 60000 (Kafka’s default is 15 minutes). - Pilot creates its own topics. Existing Pilot topics from a standalone install
need one partition, replication factor 3 or more and
min.insync.replicas2 or more; see Change the Mode. - One Pilot installation per Kafka cluster. Installations that share a Kafka
cluster, HA or standalone, are not isolated from each other: the names of
Pilot’s topics are fixed, and only
AUDIT_TOPICcan be set. - The same resources for every replica, since any standby can become active; see Resource Sizing.
The Service always carries a grpc port for Pilot Agents
(agent.grpcPort, default 9190), also while agents are off. For IPv6 Pod
addresses, set ha.ipFamily: IPv6; HA routes one address family, not dual-stack.
Decide ports, ha.ipFamily, ha.names.* and auth.pat.enabled
before the first install.
The first replica to start enrolls the installation: it writes the binding, creates the topics Kafka lacks and labels the Lease, the Service and the EndpointSlice. If the first start is interrupted, the next replica continues it. When Kafka refuses a topic creation, for example without the Create ACL, the next start tries again. After the first start, back up the binding.
Two errors of the first start need a fix by hand:
-
missing after a retained creation intent: the answer to a topic creation was lost, and the topic is missing. Check that Kafka has no topic of that name, then remove the record from the ConfigMap’sregistration.jsonkey, here for__pilot_broker_state; name the topic of the error:kubectl -n pilot get configmap pilot-ha-binding -o json \ | jq '.data["registration.json"] |= (fromjson | del(.creating["__pilot_broker_state"]) | tojson)' \ | kubectl replace -f - -
HA enrollment conflict: a__pilot_operationstopic exists that the binding does not record. When its ConfigMap was lost, restore the ConfigMap from its backup, or start a new installation as under Reinstall after a quarantine. When the topic belongs to another HA installation on the same Kafka cluster, do not delete or adopt it: either would take the other installation’s operations.
Apart from these edits, do not change the binding ConfigMap. A replica stops when a topic that the binding records is missing or was recreated. Replicas wait NotReady and log the reason when they cannot read the binding, or when they are configured with other object names than it records, or with PATs while it has no PAT topic.
Conditions topic
__pilot_conditions holds the cluster conditions
and their 24-hour history. It is not one of the HA topics: enrollment does not
create it, the binding does not pin its ID, and the replication and min ISR
requirements of the enrolled topics do not apply to it. Pilot creates it when
Kafka lacks it, as standalone Pilot does: one partition, the brokers’
default.replication.factor, cleanup.policy=compact,delete,
retention.ms=86400000 and segment.ms=3600000. It uses an existing topic as
it is and sets these three settings on it again. Only the active replica writes
it.
Pilot runs without the topic. When Kafka refuses its creation, a read or a write, for example without the ACLs, the conditions list still works and starts empty on the next active replica. With the topic, the active conditions, with the time each began and how often it returned, and the history survive a failover.
Configuration
The chart sets the HA variables from ha.enabled and ha.names.*, and the POD_*
variables through the Downward API. config and extraEnv refuse all of them.
| Variable | Value | Chart value |
|---|---|---|
PILOT_HA_ENABLED | true to enable HA; default false | ha.enabled |
PILOT_HA_BINDING_NAME | Binding ConfigMap; default pilot-ha-binding | ha.names.binding |
PILOT_HA_LEASE_NAME | Lease; default pilot-ha | ha.names.lease |
PILOT_HA_SERVICE_NAME | Selectorless Service; default pilot | ha.names.service |
PILOT_HA_ENDPOINT_SLICE_NAME | EndpointSlice; default pilot-active | ha.names.endpointSlice |
POD_NAME, POD_UID, POD_NAMESPACE, POD_IP | Downward API metadata.name, metadata.uid, metadata.namespace and status.podIP |
For custom names, set ha.names.* before the first install.
Set Kafka, authentication and the license through the chart’s
values, and other settings, such as AUDIT_TOPIC and
PILOT_THROTTLE_*, in config; see Other settings.
The chart takes credentials only from existing Secrets; see
Secrets.
All replicas share the same secrets: AUTH_COOKIE_SECRET with browser sign-in,
and AUTH_PAT_HASH_SECRET with PATs, each at least 32 bytes.
The chart refuses most of the following settings when it renders. HA also refuses to start with:
AUTH_PAT_ENABLED=trueand no enabled OAuth/OIDC provider. Without a provider, Pilot runs without authentication and never checks PATs. Configure a provider before exposing Pilot.AUTH_COOKIE_SECRETshorter than 32 bytes with an enabled OAuth/OIDC provider, orAUTH_PAT_HASH_SECRETshorter than 32 bytes with PATs enabled.AUDIT_ENABLEDturned off. HA needs the audit log.METADATA_UPDATE_INTERVALabove20s(default10s).PILOT_THROTTLE_RATE_MBbelow1, orPILOT_THROTTLE_MAX_RATE_MBbelowPILOT_THROTTLE_RATE_MB, whilePILOT_THROTTLE_MANAGED=true, as in standalone mode.PORToutside 1 to 65535 or equal to8081, the private probe port.PILOT_AGENT_GRPC_PORToutside 1 to 65535, equal toPORTor8081, or not a number, even with the Pilot Agent disabled.PILOT_AGENT_ENABLED=truewithout bothPILOT_AGENT_CA_CERT_FILEandPILOT_AGENT_CA_KEY_FILE, withPILOT_AGENT_INSECURE=true, or withoutPILOT_AGENT_BINARY_CACHE_DIRorPILOT_AGENT_BINARY_DIR.
Kubernetes RBAC
The chart’s runtime Role lets Pilot read and update the Lease, the EndpointSlice,
the Service and the binding ConfigMap, and list EndpointSlices and pods in the
namespace. Pilot needs update on the Service and the ConfigMap only for the first
start. Set ha.rbac.enrollmentFinished: true afterwards to drop it, and set it
back to false before a reinstall.
The two list permissions cover every pod and EndpointSlice in the namespace, so install Pilot in a namespace of its own.
Where the installer may not create Roles and RoleBindings, set
ha.rbac.create: false and have a cluster administrator create them. Render them
from the chart with the release’s name, namespace and values, so they name the
same objects and ServiceAccount. Under Argo CD, the release name is the
Application’s helm.releaseName, or else the Application’s name:
helm template pilot oci://registry-1.docker.io/calinora/pilot-chart --version <chart version> -n pilot \
-f values.yaml --set ha.rbac.create=true --show-only templates/ha-rbac.yaml > pilot-ha-rbac.yaml
kubectl apply -n pilot -f pilot-ha-rbac.yamlWith Helm 3.14 or older, add --kube-version with the cluster’s Kubernetes
version to the render.
Apply both before the install or right after it: the replicas stay NotReady until
both exist, and helm install --wait waits for them. Before each chart upgrade,
render them with the new chart version and apply them. To narrow the Role after
the first start, add --set ha.rbac.enrollmentFinished=true to this and every
later render until a reinstall; the chart refuses enrollmentFinished in its own
values while ha.rbac.create is false. helm uninstall leaves both in place.
With Argo CD’s label tracking (application.resourceTrackingMethod: label, the
default before Argo CD 3.0), an Application named like the release lists both
through their app.kubernetes.io/instance label, and pruning deletes them.
Annotate the render before you apply it:
kubectl annotate --local -f pilot-ha-rbac.yaml -o yaml argocd.argoproj.io/sync-options=Prune=false \
argocd.argoproj.io/compare-options=IgnoreExtraneous > pilot-ha-rbac-argocd.yaml
kubectl apply -n pilot -f pilot-ha-rbac-argocd.yamlTo switch an installed release to ha.rbac.create: false, first annotate the
chart’s Role and RoleBinding so that the upgrade keeps them. If the release sets
ha.rbac.enrollmentFinished: true, set it to false in the values and add it to
the render instead.
kubectl -n pilot annotate role/pilot-ha-runtime rolebinding/pilot-ha-runtime helm.sh/resource-policy=keepAn Argo CD Application with pruning ignores that annotation and deletes them. With annotation tracking, the default since Argo CD 3.0, annotate them before the sync instead:
kubectl -n pilot annotate role/pilot-ha-runtime rolebinding/pilot-ha-runtime argocd.argoproj.io/sync-options=Prune=falseAfter the sync, remove that annotation and the tracking annotation, so that the Application no longer lists them and shows Synced:
kubectl -n pilot annotate role/pilot-ha-runtime rolebinding/pilot-ha-runtime \
argocd.argoproj.io/sync-options- argocd.argoproj.io/tracking-id-Switching back to ha.rbac.create: true then needs no further step. With label
tracking, add the two annotations of the render above instead. Keep them while
ha.rbac.create is false, and remove them after switching back.
To hand them back to a Helm release, mark them as the release’s before the upgrade
with ha.rbac.create: true, and remove the keep annotation. Helm also needs the
app.kubernetes.io/managed-by: Helm label, which the render carries:
kubectl -n pilot annotate role/pilot-ha-runtime rolebinding/pilot-ha-runtime \
meta.helm.sh/release-name=pilot meta.helm.sh/release-namespace=pilot helm.sh/resource-policy- --overwriteKafka ACLs
Kafka Permissions lists the permissions of standalone Pilot and describes the ones both modes share.
The runtime Kafka principal needs these ACLs:
| Resource | Operations | Used for |
|---|---|---|
Topics __pilot_operations, __pilot_broker_state, __pilot_pat_tokens (with PATs) and AUDIT_TOPIC | Read, Write, Describe, DescribeConfigs | Pilot’s own state |
| The same topics | Create | The first start creates the ones Kafka lacks; not needed afterwards |
Topic __pilot_conditions | Create, Describe, AlterConfigs, Read, Write | The conditions topic: Pilot creates it when Kafka lacks it, sets its cleanup policy, retention and segment time, and reads and writes the conditions. Without these ACLs Pilot runs and the conditions list starts empty after a failover |
Topic __transaction_state | Describe, DescribeConfigs | The check of Kafka’s transaction settings each time a replica becomes active |
Transactional ID pilot-ha-<hash>, or the prefix pilot-ha- | Write, Describe | Pilot’s writes of its own state |
| Cluster | Alter | Moving partitions, leader elections, log directory moves and ACL changes |
| Cluster | Describe, DescribeConfigs | Reading reassignments, log directories, ACLs, client quotas, the cluster and broker configuration |
| Cluster | AlterConfigs | Client quota changes, and broker throttle rates with throttle management |
| Data topics | Describe, DescribeConfigs | Reading topics, offsets and topic configuration; without it no rebalance is accepted |
| All topics, Kafka’s internal topics included | DescribeConfigs | The rolling restart’s min.insync.replicas check before each broker’s stop; a topic it cannot read refuses the stop |
| Data topics | AlterConfigs | Topic configuration changes, and throttled replica lists with throttle management |
| Data topics | Read | Offset resets and message browsing |
| Consumer groups | Describe, Read, Delete | Consumer group monitoring, offset resets and group deletes |
Grant the prefix pilot-ha- before the first start. To grant the literal ID
instead, grant it after the first start: <hash> is the lowercase hex SHA-256 of
<installationID>:<restoreEpoch> from the binding. Until the grant exists, each
active replica hands over, and the next one retries. For the literal ID, read the
binding, set INSTALLATION_ID and RESTORE_EPOCH from it, and compute the ID:
kubectl -n pilot get configmap pilot-ha-binding -o jsonpath='{.data.binding\.yaml}'
printf 'pilot-ha-%s\n' "$(printf '%s:%s' "$INSTALLATION_ID" "$RESTORE_EPOCH" | sha256sum | cut -d' ' -f1)"When Kafka refuses a permission, the active replica hands over and logs
HA controller stepped down with the refused request. After repeated refusals it
waits up to five minutes before it tries again;
kubectl rollout restart deployment/pilot retries at once.
Pilot makes ACL changes with this principal, so the credential can change every ACL: protect it like an administrator credential. Grant Write on Pilot’s topics only to this principal.
On a Kafka cluster that enforces ACLs, grant both AlterConfigs permissions, or set
PILOT_THROTTLE_MANAGED=false; see Replication throttles.
Client quota changes and topic configuration changes need AlterConfigs in either
case.
Sessions and forwarded headers
Browser sessions survive a failover. Users may have to sign in again when Pilot needs a fresh token from the provider.
A sign-in whose identity and group claims are too large for the session cookie is refused.
Logout clears the browser’s cookie but does not revoke the session. A copied
cookie stays valid on every replica until AUTH_SESSION_TTL expires (default
12h), so use a short TTL. Rotating the shared AUTH_COOKIE_SECRET ends every
session.
Pilot takes the audit client IP from the first X-Forwarded-For entry and builds
the OAuth redirect URI from X-Forwarded-Proto and X-Forwarded-Host, from any
source. PILOT_TRUSTED_PROXIES does not restrict either. Reach Pilot only through
the ingress or router, configure it to replace client-supplied forwarded headers,
and register the exact callback URI with the provider.
Pilot Agents
Pilot Agents connect to the active replica through the
Service’s grpc port. After a failover the agents reconnect to the new active
replica by themselves. Agent logs start over there. Agent actions follow
Supported actions.
Every replica uses the same agent CA, so an agent’s certificate stays valid across
failovers. The chart mounts the Secret that agent.ca.secretName names into every
pod and sets PILOT_AGENT_CA_CERT_FILE, PILOT_AGENT_CA_KEY_FILE and
PILOT_AGENT_BINARY_CACHE_DIR. See Pilot Agents
for creating the CA and bootstrap token Secrets and for the agents’ settings.
- Agents inside the cluster dial the Service’s
grpcport and bootstrap through itshttpport. In a cluster with another cluster domain thancluster.local, add the Service’s full name toagent.tlsSans. - Agents outside Kubernetes, such as agents on the broker hosts, bootstrap through
the HTTPS ingress or Route and dial a TLS-passthrough route to the
grpcport that you set up. Add its name toagent.tlsSans. - The route must reach the pods through the
pilotService, through a controller that reads EndpointSlices: for example an ingress controller’s TLS passthrough topilot:9190, a Gateway APITLSRouteor an OpenShift passthrough Route with targetPortgrpc. A Service of its own that selects the Pilot pods, such as aLoadBalancer, also routes to the standbys, which do not listen for agents.
To rotate the CA, follow the steps under
Environment Variables: for each
step that rolls Pilot, update the Secret and run
kubectl -n pilot rollout restart deployment/pilot. Once ca.key switches to the
new CA, usually every agent fails TLS once and bootstraps again with
AGENT_BOOTSTRAP_TOKEN set to the master token. An agent enrolled with a
single-use enrollment token stays offline until it gets a fresh enrollment token
or the master token.
If agents are turned off (agent.enabled: false) while an agent action or a
rolling restart is running, the operation cannot end. GET /api/v1/ha then
reports escalated: true with a reason that names PILOT_AGENT_ENABLED, and
every new change answers 503 HA_NOT_READY with that reason. Set
agent.enabled: true and run helm upgrade to let the operation end.
Binding example
The first start writes this shape to binding.yaml in the binding ConfigMap. These
IDs are examples, not values to copy:
schemaVersion: 1
installationID: 845c417e-3c3d-4a96-884d-ab877e8d0732
restoreEpoch: 1
clusterID: LSpVBtR0QFmvJlJJhEwL9w
namespace: pilot
leaseName: pilot-ha
serviceName: pilot
endpointSliceName: pilot-active
topics:
__pilot_operations: "0123456789abcdef0123456789abcdef"
__pilot_broker_state: "123456789abcdef0123456789abcdef0"
__pilot_pat_tokens: "23456789abcdef0123456789abcdef01"
controlProtocolVersion: 1Pilot writes the binding once, at the first start, and never changes it. Do not
edit it. Replacing a pod or a node needs no change to it. __pilot_conditions is
not in the binding; see Conditions topic.
Back up the binding
Without the binding ConfigMap, the installation’s topics cannot be used again. Once the first start has finished, save it:
kubectl -n pilot get configmap pilot-ha-binding -o json \
| jq 'del(.metadata.resourceVersion, .metadata.uid, .metadata.creationTimestamp, .metadata.managedFields)' \
> pilot-ha-binding.jsonThe copy keeps the ConfigMap’s labels and annotations, Helm’s included, so the
release keeps managing the restored object. Without the ConfigMap, every replica
waits NotReady. Restore it while it is absent, before any helm upgrade, which
would recreate it empty. If an upgrade already recreated it empty, delete that
copy first:
kubectl create -f pilot-ha-binding.jsonRecover a deleted Lease, Service or EndpointSlice
If the Lease is deleted, the active replica stops being active, and every replica waits,
NotReady, until it exists again. Deleting the Service also deletes the
EndpointSlice it owns. Pilot does not recreate these objects. Run helm upgrade
with the installed chart version and the same values; helm list -n pilot shows
the version. It recreates the missing objects without the installation label.
helm upgrade pilot oci://registry-1.docker.io/calinora/pilot-chart --version <chart version> -n pilot -f values.yamlPilot uses these objects only with the installation label, and the EndpointSlice only with its owner reference to the Service. Read the installation ID from the binding, give the EndpointSlice its owner reference, label the Service and the EndpointSlice, and label the Lease last:
INSTALLATION_ID="$(kubectl -n pilot get configmap pilot-ha-binding \
-o jsonpath='{.data.binding\.yaml}' | sed -n 's/^installationID: //p')"
kubectl -n pilot patch endpointslice/pilot-active --type=merge -p \
"{\"metadata\":{\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Service\",\"name\":\"pilot\",\"uid\":\"$(kubectl -n pilot get service/pilot -o jsonpath='{.metadata.uid}')\",\"controller\":true}]}}"
kubectl -n pilot label --overwrite service/pilot endpointslice/pilot-active \
"pilot.calinora.io/installation-id=$INSTALLATION_ID"
kubectl -n pilot label --overwrite lease/pilot-ha \
"pilot.calinora.io/installation-id=$INSTALLATION_ID"Promotion and recovery
When the active replica fails, a standby takes over. It reads Pilot’s state from Kafka, serves monitoring, and then continues the running operation. With a large running operation the read takes longer; it has no time limit while it makes progress. See Resource Sizing.
On a three-broker cluster, the first start needs all three brokers up. Later, a failover works with one broker down.
When the active replica is terminated, for example in a rollout, it stops sending changes to Kafka and hands over. It does not cancel copying in Kafka and does not remove throttles: the next active replica continues the operation and removes its throttles. A forced kill of the active replica can leave a request with an unknown outcome; see Uncertain requests and external work.
GET /api/v1/ha shows the state: monitoringReady, mutationReady with
mutationReason, and the running operationId. It does not show an apply that
is still being written; see
Apply, retry and cancellation. It sends no Kafka
requests. Until a new active replica has restored the running operation and the history,
GET /api/v1/reassignments/{id} answers 503 HA_NOT_READY with the reason
reassignment status is recovering instead of not found, and lists can show no
running operation.
| Log line | Meaning | What to do |
|---|---|---|
HA committed replay of __pilot_operations at offset ... | A new active replica is reading Pilot’s state. It logs its progress every 10 seconds | Wait |
HA controller stepped down: ... | The replica stopped being active and waits as a standby again. The line names the reason, for example a refused ACL or no reachable broker | Fix the named cause |
HA lifecycle stopped: ... | The process ended with an error. Kubernetes restarts the container | Fix the named cause if it repeats |
A warning with administration stays closed or PAT authentication stays closed | A quarantine: Pilot cannot trust a record in one of its topics. Changes stay closed, or every PAT is rejected. Monitoring and browser sessions continue | Reinstall after a quarantine |
__pilot_conditions is never quarantined: Pilot skips a record of it that it
cannot read and logs a warning.
Waiting for Kafka
If Kafka is unavailable, the active replica waits and does not hand over. While a
broker still answers, browser monitoring continues. Requests with a PAT and all
changes answer 503 HA_NOT_READY until Kafka accepts writes again.
GET /api/v1/ha then reports mutationReady: false with a mutationReason such
as waiting for Kafka to commit Pilot's state writes since 2026-10-21T17:25:05Z.
A replica that reaches no broker at all stops serving after 30 seconds and hands
over to a standby after 2 minutes. After repeated failed takeovers a replica waits
up to five minutes before it tries again, so Pilot can take that long to serve
again after Kafka returns. kubectl rollout restart deployment/pilot retries at
once.
Measurements after a failover
Standbys do not connect to Kafka, so they hold no measurements. Each new active replica starts measuring from zero once it has read Pilot’s state. This applies to every change of the active replica, including a rollout:
- Unless moves are running or settling, proposals read Collecting measurements with a new 5-minute window, for example 28s of 5m measurement history collected.
- Plan confirmation starts again from zero, also for a plan that was at 2 of 3 fresh measurements collected.
- Without
force=true, a balancing proposal can be applied again at the earliest 5 minutes after the new active replica starts measuring. See Measurement Readiness. - The 10-minute wait for concentrated topics and the size estimate for compacted topics start again.
- A proposal ID from the previous active replica answers
404. Review the current proposal and apply it with a newIdempotency-Key. A repeat under the key of an accepted apply still returns its operation. - Each self-healing loop loses its 30-minute wait after its own last apply, unless the new active replica finished that heal.
The new active replica restores recent moves from __pilot_operations. The
30-minute cooldown of recently moved
partitions continues, and so does settling
with a network broker profile. Without one, moves that ended before the new
active replica’s first proposal calculation get no settling wait beyond the new
5-minute window.
Apply, retry and cancellation
To apply a proposal over REST:
- Save the proposal ID and an
Idempotency-Keyof your choice. - Send the apply request with that key in the
Idempotency-Keyheader. Pilot answers202with anoperationId. - If you get no answer, send the same request again as the same user. Pilot returns the same operation and does not start a second rebalance.
The UI keeps the request in the browser tab, also through a reload.
For a very large plan the answer is 202 with status: pending and progress.
Repeat the request with the same key until the answer is no longer pending; the
UI shows the progress with a Stop button. A pending apply does not survive a
failover: review the current proposal and apply it again with a new key. An apply
that failed while it was pending answers each repeat with its cause for 10
minutes: 409 or 413 HA_ACCEPT_FAILED, or 503 HA_UNCERTAIN while its outcome
is unknown.
GET /api/v1/ha does not show a pending apply: operationId names it only once
it is accepted, and mutationReady stays true. Until then another data movement
is refused with 409; the repeat of the apply under its key shows the progress.
A cancel answers 202 when Pilot has recorded it. From then on Pilot starts no
new moves for the operation. Kafka may still be copying for a short time: follow
cancelPending in GET /api/v1/ha. Repeating a cancel is safe:
- After a
503, send the cancel again. - A cancel after the operation ended answers
202if the operation was cancelled, and409 HA_OPERATION_ENDEDif it ended without a cancel. - A cancel of a pending apply stops it. It answers
status: "abort_requested"when nothing was accepted, orcancel_requestedwhen the operation was accepted first.
MCP apply_proposal needs a concrete proposalId, not current; its
idempotencyKey of at most 256 bytes is optional. cancel_reassignment takes an
operation ID or all. See MCP in HA mode, and
the API reference for request
and response details.
Large operations
HA has no plan-size limit, like standalone Pilot. A large plan needs more memory; see Resource Sizing. These limits apply:
| Limit | Value | When exceeded |
|---|---|---|
| Partitions in one Kafka request | PILOT_HA_MAX_REQUEST_PARTITIONS (chart value ha.maxRequestPartitions), default 1000, 1 to 10,000 | Pilot sends more requests |
| Brokers in one plan | 512 | 413 HA_PLAN_TOO_LARGE |
| Replicas of one partition | 62 | 413 HA_PLAN_TOO_LARGE |
| Changes beside a data movement that are not answered yet, elections and agent commands included | 8, and 128 outstanding in all | 409 HA_BUSY with Retry-After: 5 |
A change other than a data movement answers 413 HA_PLAN_TOO_LARGE at smaller
sizes of its own, which each route’s 413 in the
API reference describes.
Pilot keeps the idempotency key of the newest 1,000 finished operations.
503 HA_JOURNAL_BACKLOG with Retry-After: 5 means Pilot is still cleaning up
after applies that did not finish: retry after that time.
Uncertain requests and external work
Sometimes Pilot cannot tell whether Kafka applied a request, for example when the
answer was lost. GET /api/v1/ha then reports uncertain: true, and
uncertainOperationId names the operation. Until this is resolved, Pilot sends no
further changes to Kafka, cancellations included. Monitoring keeps working.
- For most changes, Pilot reads the result back from Kafka, usually within a few
minutes, and continues. If the read-back is not conclusive, the request answers
500 HA_OUTCOME_UNKNOWN: check the resource yourself. Pilot never sends the change a second time. - An unknown outcome of a reassignment or a cancellation does not clear by itself.
Changes stay closed until you reinstall with
__pilot_operationsreplaced.
An operation can also wait without being uncertain:
- A partition whose target broker is down waits, and fails after 10 minutes if the broker stays down.
- A copied partition whose preferred leader is not in sync waits. Only a cancel ends the operation then.
GET /api/v1/ha shows both waits (absentBrokerWait, leaderWait). For the
running operation it also reports, among other fields:
| Field | Meaning |
|---|---|
cancelPending | true while a recorded cancel is not applied yet |
escalated | true when something has waited too long, for example an unknown outcome, partitions that wait for a down broker or copied partitions that wait for their preferred leader |
escalationReason | Each cause of escalated, separated by semicolons |
A log directory move whose copy stops progressing stays open, with no time limit,
and cannot be cancelled (503 HA_UNSUPPORTED). GET /api/v1/ha lists it under
administrativeOperations with the kind logdir, and escalated stays false
for it. It ends when the copy ends, for example after a restart of that broker,
or when the broker has been missing from the cluster, or its log directories
unreadable, for 10 minutes. Until then it counts toward the 128 outstanding
changes, not toward the 8 unanswered ones; see
Large operations.
Pilot leaves reassignments started outside Pilot alone. It does not cancel or clean them up, and it does not plan moves for partitions that are already moving. If a partition of an accepted plan reaches another placement outside Pilot, or its topic is deleted or recreated, Pilot marks the partition failed. A reassignment you start for a partition at the same moment as Pilot can be replaced by Pilot’s target.
Replication throttles
With PILOT_THROTTLE_MANAGED=true, the default, HA sets replication throttles for
the partitions its operations move and removes them afterwards. An operation keeps
the setting it was accepted with, also after a failover. Operations accepted with
false set no throttles; they still remove the leftovers of earlier
operations.
| Configuration | Set on | Value |
|---|---|---|
leader.replication.throttled.rate, follower.replication.throttled.rate | Each broker in a moving partition’s current and added replicas | The operation’s rate |
replica.alter.log.dirs.io.max.bytes.per.second | The same brokers | 1.5 times the operation’s rate, as in standalone mode |
leader.replication.throttled.replicas | The partition’s topic | <partition>:<broker> for each current replica |
follower.replication.throttled.replicas | The partition’s topic | <partition>:<broker> for each added replica |
Leadership-only changes get no throttle. The rate comes from
PUT /api/v1/reassignments/tuning, which applies to all replicas, otherwise from
PILOT_THROTTLE_RATE_MB. A running operation follows a changed rate.
Before it accepts an operation with throttles, Pilot checks that its principal has
AlterConfigs on Cluster and on every moved topic. Without them it refuses the
operation with 409 HA_THROTTLE_PERMISSION and names the missing ACLs:
HA throttle management needs AlterConfigs on Cluster and AlterConfigs on Topic orders for Pilot's principal: grant these ACLs or set PILOT_THROTTLE_MANAGED=falseWhen Kafka rejects the check for another reason, for example under an alter-config
policy, Pilot refuses the operation with 409 HA_THROTTLE_PREFLIGHT_REJECTED and
names the resource and Kafka’s error. A retry does not help until the ACLs, the
policy or PILOT_THROTTLE_MANAGED change. Nothing is accepted in either case. MCP
apply_proposal returns the same message as a tool error, and self-healing logs
it as a warning.
Pilot changes only its own throttles:
- It never overwrites a per-broker rate it did not set, and it adds and removes only its own entries in a throttled replica list; see Throttles Pilot Did Not Set.
- A partition moves only after its throttle is in place. If Kafka keeps refusing
the throttle, Pilot fails the partition with
replication throttle could not be applied. - When an operator changes a value Pilot set, Pilot leaves that key to the operator for the rest of the operation and records the change in the audit log.
- Pilot removes its throttles also when its license has lapsed. HA runs no removal of leftover throttles at startup.
Leftovers
Pilot removes its throttles when an operation ends. If a broker or topic cannot be reached, or Kafka refuses the removal, the throttle stays as a leftover. The next operation removes it, whether that operation manages throttles or not. Nothing else removes leftovers: they stay until the next operation or until you remove them.
To see leftovers, query the audit log with
GET /api/v1/audit-log?action=throttles.ha-ownership. Pilot records each leftover
as an event with query.reason residual. The audit log keeps the event after a
later operation removed the leftover, so check the broker or topic with
kafka-configs.sh --describe before you delete anything.
The event’s query.resource names the broker or topic. query.key names the
configuration key or, for a topic’s list entries, the partition. query.value
names the cause. refused means Kafka rejected the removal, for example for a
missing AlterConfigs ACL or an alter-config policy. Fix the cause; the next
operation retries.
To remove a leftover by hand, delete a broker rate only while
it still shows a rate Pilot set (see the table above), and only the key the audit
event names, such as replica.alter.log.dirs.io.max.bytes.per.second. For a topic
list, set the list to its current entries without Pilot’s; deleting the key also
removes other tools’ entries.
kafka-configs.sh --bootstrap-server kafka-0.kafka:9093 --command-config client.properties \
--entity-type brokers --entity-name 5 --describe
kafka-configs.sh --bootstrap-server kafka-0.kafka:9093 --command-config client.properties \
--entity-type brokers --entity-name 5 --alter \
--delete-config leader.replication.throttled.rate,follower.replication.throttled.rateLimitations
- A value an operator writes on one of Pilot’s keys at the same moment as Pilot can be replaced or removed. An operator who sets one of Pilot’s own values on one of its keys during the operation loses it when Pilot removes its throttles.
- Pilot never writes a key it left to an operator or found set by one. If the operator removes that value during the operation, Pilot’s moves on that broker run without a rate.
kafka-reassign-partitions --throttlereplaces both replica lists of its topics, and--verifyremoves broker rates and those lists once its reassignment completes. Both can remove Pilot’s throttles during an operation.- While Pilot’s rate is set on a broker, it also throttles the listed replicas of external reassignments there.
- Scaling to zero or uninstalling leaves Pilot’s throttles and leftovers in place.
- A move of a partition of Pilot’s own topics, or of the
__transaction_statepartition of its transactions, can hold Pilot’s state writes while the throttle on those brokers is saturated: 40 seconds or more at 0.5 MB/s, none in 15 drains at the default 50 MB/s. Changes answer503 HA_NOT_READYmeanwhile, as can requests with a PAT. Pilot recovers by itself and loses nothing; a longer hold can end in a failover to a standby. Keep Pilot’s rate, also one set with the tuning API, and throttles set outside Pilot on those brokers at 50 MB/s or more.
Kubernetes and OpenShift maintenance
The chart’s HA defaults are three replicas (ha.replicas), maxUnavailable=0 and
maxSurge=1 (ha.strategy), a PodDisruptionBudget that allows one voluntary
disruption (ha.pdb) and a 60-second termination grace.
- A Ready standby shows that its process runs and can read the Lease, not that it can reach Kafka. A standby that cannot read the Lease stays NotReady, which stops a rollout.
- A rolling update does not know which replica is active, so one rollout can cause several failovers. A completed rollout does not prove that Pilot recovered.
- Do not go back to an older image; see Rollback.
Check Pilot before and after each maintenance step, such as evicting the active
Pod, an image update or a node drain. Send GET /api/v1/ha authenticated:
monitoringReadyis true anduncertainis false.- After the step, a running operation still has the same
operationId, or it has completed.
If the check still fails 60 seconds after the step, stop and do not take the next
step. Stop also when uncertain is true. While a broker rolling restart runs
(operationKind is rolling-restart), wait for it to end first.
To hand over to a standby, evict the active Pod through the eviction API, which
honors the PodDisruptionBudget, with its UID as a precondition. The endpoint of
the EndpointSlice pilot-active names the active Pod and its UID in targetRef:
POD=ACTIVE_POD POD_UID=ACTIVE_POD_UID
kubectl create --raw "/api/v1/namespaces/pilot/pods/$POD/eviction" -f - <<EOF
{"apiVersion":"policy/v1","kind":"Eviction","metadata":{"name":"$POD","namespace":"pilot"},"deleteOptions":{"preconditions":{"uid":"$POD_UID"}}}
EOFFor an image update:
-
Keep the chart’s Deployment and add a one-replica Deployment on the new image, written by hand outside the chart, for example from the release’s Deployment in
helm get manifest pilot -n pilot. Give it a name and a selector label of its own, the same ServiceAccount and the chart’s pod labelsapp.kubernetes.io/name,app.kubernetes.io/instanceandpilot.calinora.io/lease-name. It needs no Service or Lease of its own. -
Once its Pod is Ready, evict the active Pod, one eviction at a time, each checked, until the active Pod’s
pilotcontainer runs the new image:kubectl -n pilot get pod ACTIVE_POD -o jsonpath='{.spec.containers[?(@.name=="pilot")].image}' -
If it does not after six evictions, stop and keep the chart’s Deployment as it is.
-
Once the new image has been active, run
helm upgradewith the new chart version. Check another eviction, then remove the one-replica Deployment.
Drain one node at a time. Check before the drain, see which node runs the active Pod, then drain. If a drain fails, stop. Check again after each drain.
kubectl -n pilot get pods -l app.kubernetes.io/name=pilot -o wide
kubectl drain <node> --ignore-daemonsets --delete-emptydir-data --timeout=180sCheck how many Pilot replicas a node holds before draining it. With the default
topology spread (ha.topologySpread), a drained node that holds more than one
replica can stall the drain: a replacement stays Pending until the node is
uncordoned.
OpenShift has not been tested yet. The optional Route, from the route values
(see Exposure), needs a router that reads
EndpointSlices. Check that the router replaces client-supplied forwarded headers.
After a failover, monitoring is usually back within 60 seconds. This is a target, not a guarantee. A large running operation extends it; see Resource Sizing.
Reinstall after a quarantine
A quarantine means that Pilot found a record in one of its topics that it cannot
trust. It does not clear: every new active replica reads the same record and
quarantines it again. The way out is a new installation with a replaced copy of
the topic that holds the record. This discards every record of that topic; for
__pilot_operations that is each operation’s plan, status, history and
idempotency key. Throttles Pilot set stay in place, and the new installation never
removes them.
The warning names the topic to replace:
| Warning | Topic |
|---|---|
HA journal quarantined a committed record; administration stays closed: ... | __pilot_operations |
...; broker-state administration stays closed | __pilot_broker_state. Broker states such as maintenance mode are lost |
...; PAT authentication stays closed | __pilot_pat_tokens. Every PAT stops working; issue new ones |
Keep the other topics: the new installation adopts an existing topic other than
__pilot_operations. AUDIT_TOPIC is never quarantined, so
its audit log stays. __pilot_conditions is never quarantined either: keep it,
or delete it to start with an empty conditions history; Pilot creates it again.
Replace __pilot_broker_state and __pilot_pat_tokens as well
only to start from empty state. The same steps, with __pilot_operations kept, start
a new installation after an enrollment conflict.
The commands use the default names; the binding lists the ones in use. Run them
with your own Kubernetes and Kafka administrator credentials: the runtime Role
cannot delete.
-
Save the current throttle settings of the brokers and topics (
kafka-configs.sh --describe). -
Stop every replica: delete a one-replica Deployment written for an image update (see Kubernetes and OpenShift maintenance), scale the chart’s Deployment to zero, wait until the second command lists no pod, then uninstall the release. The four kept objects stay:
kubectl -n pilot scale deployment/pilot --replicas=0 kubectl -n pilot get pods -l app.kubernetes.io/name=pilot helm uninstall pilot -n pilot -
When you keep
__pilot_operations, note its ID,topics.__pilot_operationsin the binding or the ID an enrollment conflict names. Then delete the kept objects, so that the next install starts a new installation:kubectl -n pilot get configmap pilot-ha-binding -o jsonpath='{.data.binding\.yaml}' kubectl -n pilot delete --ignore-not-found configmap/pilot-ha-binding \ lease/pilot-ha endpointslice/pilot-active service/pilot -
Delete each topic you replace, then repeat the listing until it prints nothing. For
__pilot_operations:kafka-topics.sh --bootstrap-server kafka-0.kafka:9093 --command-config client.properties \ --delete --topic __pilot_operations kafka-topics.sh --bootstrap-server kafka-0.kafka:9093 --command-config client.properties \ --list --topic __pilot_operations -
Remove the old installation’s throttles by hand, as under Leftovers. Pilot never changes a value it did not set, and a leftover broker rate keeps it from setting its own on that key.
-
In
values.yaml, setha.rbac.enrollmentFinished: false. Withha.rbac.create: false, apply the Role rendered withoutenrollmentFinishedinstead. Setha.adoptOperationsTopic: <topic ID>when you keep__pilot_operations, and otherwise leave it empty. If you revoked Create on the HA topics in Kafka, grant it again: the first start needs it. -
Install the chart again, without the flags to avoid. The first start creates a new installation and the replaced topic:
helm install pilot oci://registry-1.docker.io/calinora/pilot-chart --version <chart version> -n pilot -f values.yaml kubectl -n pilot rollout status deployment/pilot --timeout=180s -
With ACLs and a literal transactional ID grant, grant the new installation’s transactional ID, computed from the new binding as under Kafka ACLs, and remove the old installation’s grant. Then back up the binding, and set
ha.rbac.enrollmentFinished: trueagain withhelm upgrade, or withha.rbac.create: falseapply the Role rendered with it.
Rollback
An older image quarantines records it does not know (see
Promotion and recovery): changes stay closed, and it
never removes Pilot’s throttles. Roll forward to the current image instead, or
reinstall after a quarantine. helm rollback
returns to an earlier release’s chart and values, and with them usually to its
image, so the same rule applies; see Flags to avoid.
The dismissal of a rolling restart’s outcome
writes such a record, settings/rolling-restart-dismissal, which an image
without dismissals does not know. While replicas of such an image still run,
dismiss no outcome: wait until every replica runs the new image.
Pilot 0.28 has no HA mode. It can apply changes that HA refused, such as the maintenance flag of a drain HA refused or a token revocation HA reported as failed. After going back to a standalone Pilot 0.28:
- Compare each broker’s maintenance flag with what HA showed, and set again what differs.
- A token that reads as revoked stays revoked: issue a new one.