Affinity Values Configuration
Affinity configurations control pod scheduling behavior in SUSE® Observability. 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"
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
Usage
-
Recommended method
-
Legacy method (Deprecated)
Add affinity configuration directly to your values.yaml file under global.suseObservability.affinity:
global:
suseObservability:
# Your existing configuration
license: "YOUR-LICENSE-KEY"
baseUrl: "https://observability.example.com"
sizing:
profile: "150-ha"
adminPassword: "$2a$10$..."
# Affinity configuration
affinity:
# Node 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
# Pod anti-affinity for HA profiles (infrastructure components)
podAntiAffinity:
# true = hard anti-affinity, false = soft anti-affinity
requiredDuringSchedulingIgnoredDuringExecution: true
topologyKey: "kubernetes.io/hostname"
Then install or upgrade with a single command:
helm upgrade --install \
--namespace suse-observability \
--create-namespace \
--values values.yaml \
suse-observability \
suse-observability/suse-observability
| For HA profiles, pod anti-affinity is automatically applied to all stateful data services. You only need to configure it if you want to change the default behavior. |
For more details on migration from the legacy method, see the migration guide.
|
This method is deprecated. For new installations, use the recommended method above. For existing installations using this method, see the migration guide to transition to the new configuration format. |
==== 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