To run multiple controller replicas (controller.replicas > 1), you must ensure that replicas do not co-locate on the same node. This is because the controller uses hostNetwork: true and its liveness-probe sidecar binds to a fixed host port (controller.livenessProbe.healthPort, default 29652). If two pods attempt to run on the same node, the second pod's sidecar will fail to bind the port, causing a CrashLoopBackOff.
Requirements for HA:
- The cluster must have at least as many schedulable nodes as
controller.replicas. - You must apply
podAntiAffinity using the kubernetes.io/hostname topology key to prevent co-location.
Note: If you see leader-election log lines like "Failed to update lease optimistically, falling back to slow path" in the active controller, this is normal behavior when multiple candidates are racing for the same lease and does not indicate a bug.
Single-node clusters: For development clusters like k3d or kind, you must keep controller.replicas=1.
controller:
replicas: 2
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- topologyKey: kubernetes.io/hostname
labelSelector:
matchLabels:
app: csi-nfs-controller