This is unreleased documentation for SUSE® Storage 1.11 (Dev).

CSI Component Pod Anti-Affinity

This document describes how to configure pod anti-affinity for Longhorn CSI components. Pod anti-affinity increases storage resilience especially in small clusters by ensuring that multiple replicas of a CSI component do not run on the same node.

For details about pod anti-affinity, see the Kubernetes documentation on inter-pod affinity and anti-affinity.

Configuring pod anti-affinity for Longhorn CSI components

You can configure pod anti-affinity for these Longhorn CSI components:

  • csi-attacher

  • csi-provisioner

  • csi-resizer

  • csi-snapshotter

The podAntiAffinityPreset setting accepts the following values:

  • soft (default): A best-effort rule using preferredDuringSchedulingIgnoredDuringExecution. The scheduler tries to avoid placing multiple CSI replicas on the same node, but this is not guaranteed.

  • hard: A strict rule using requiredDuringSchedulingIgnoredDuringExecution. The scheduler blocks pod placement on nodes that violate the anti-affinity rule. Pods may remain in the Pending state if no suitable nodes exist.

Configuring during SUSE Storage installation

You can set the pod anti-affinity during the initial installation by using one of the following methods.

Using Rancher

When installing SUSE Storage through Rancher UI, select Edit as YAML and add the following parameters to the YAML:

csi:
    podAntiAffinityPreset: "hard"

Using Helm

When installing SUSE Storage using Helm, set the csi.podAntiAffinityPreset value in your values.yaml file:

csi:
  podAntiAffinityPreset: hard

After adding it to your values.yaml file, install the chart as usual.

Using Kubectl

If you are deploying SUSE Storage using kubectl, edit the longhorn-driver-deployer deployment manually and add the following environment variable to the container specification:

- name: CSI_POD_ANTIAFFINITY_PRESET
  value: hard

Configuring after SUSE Storage installation

Editing the deployment redeploys longhorn-driver-deployer and all CSI pods.

To update an existing installation, manually edit the longhorn-driver-deployer deployment and add the following environment variable to the container specification:

- name: CSI_POD_ANTIAFFINITY_PRESET
  value: hard