Affinity Values Configuration

The SUSE Observability Values chart generates affinity configurations you can use with the main SUSE Observability chart to control pod scheduling behavior. The affinity values help optimize resource utilization and ensure high availability by controlling where pods are scheduled.

Available Configuration Options

Node Affinity

You can use node affinity to schedule pods to specific nodes or instance groups, such as EC2 nodes deployed to the same availability zone.

affinity:
  # Node Affinity settings - applied to all components when configured
  nodeAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      nodeSelectorTerms:
      - matchExpressions:
        - key: topology.kubernetes.io/zone
          operator: In
          values:
          - us-west-2a

Pod Anti-Affinity

You can use pod anti-affinity to schedule replicas of data services to different nodes to ensure high availability. By default, the scheduling is required (hard anti-affinity) and topologyKey is kubernetes.io/hostname.

affinity:
  podAntiAffinity:
    # Enable required pod anti-affinity (true = hard, false = soft)
    requiredDuringSchedulingIgnoredDuringExecution: true
    # Topology key for pod anti-affinity
    topologyKey: "kubernetes.io/hostname"

Behavior

Node Affinity

  • When configured: Applied to all components

Pod Anti-Affinity

  • When configured: Only applied when sizing.profile ends with -ha (High Availability profiles)

  • HA Profiles: 150-ha, 250-ha, 500-ha, 4000-ha

  • Components affected: All stateful data services including Clickhouse, Kafka, Zookeeper, VictoriaMetrics, StackGraph, Elasticsearch

Example configurations

Basic Node Affinity (same Availability Zone) + hard PodAntiAffinity for HA Deployment

Assume you set sizing.profile to one of the HA profiles. The values below configure nodeAffinity to schedule components of SUSE Observability to the us-west-2a zone and enforce scheduling the replicas of the same data services to different hosts (affinity.podAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution=true by default).

affinity:
  # Schedule all pods to nodes in the same AZ
  nodeAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      nodeSelectorTerms:
      - matchExpressions:
        - key: topology.kubernetes.io/zone
          operator: In
          values:
          - us-west-2a

Soft PodAntiAffinity for HA Deployment

If enforcing scheduling of data services to different nodes is not desirable, yo can configure podAntiAffinity in "soft" mode:

affinity:
  podAntiAffinity:
    requiredDuringSchedulingIgnoredDuringExecution: false

Usage

Step 1: Create Your Affinity Values file

Create a separate values file with your desired affinity configuration. For example, save the following as suse-observability-values-values.yaml:

affinity:
  nodeAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      nodeSelectorTerms:
      - matchExpressions:
        - key: topology.kubernetes.io/zone
          operator: In
          values:
          - us-west-2a
  podAntiAffinity:
    requiredDuringSchedulingIgnoredDuringExecution: true

Step 2: Generate Affinity template values

Run the following command to generate the affinity values template:

export VALUES_DIR=.
helm template \
  --set license='<your license>' \
  --set baseUrl='<suse-observability-base-url>' \
  --set sizing.profile='<sizing.profile>' \
  --values suse-observability-values-values.yaml \
  suse-observability-values \
  suse-observability/suse-observability-values --output-dir $VALUES_DIR

Step 3: Use generated values in Helm installation

Include the generated affinity values in your Helm installation:

helm upgrade \
  --install \
  --namespace suse-observability \
  --values $VALUES_DIR/suse-observability-values/templates/baseConfig_values.yaml \
  --values $VALUES_DIR/suse-observability-values/templates/sizing_values.yaml \
  --values $VALUES_DIR/suse-observability-values/templates/affinity_values.yaml \
  suse-observability \
  suse-observability/suse-observability