-
Notifications
You must be signed in to change notification settings - Fork 15
STAC-21030: Explaining how to configure K8s affinities #1625
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
122 changes: 122 additions & 0 deletions
122
setup/install-stackstate/kubernetes_openshift/affinity.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| --- | ||
| description: SUSE Observability Affinity Configuration | ||
| --- | ||
|
|
||
| # Affinity Values Configuration | ||
|
|
||
| The Suse Observability Values chart generates affinity configurations that can be used by 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 | ||
|
|
||
| Node affinity is used to schedule pods to specific nodes or instance groups, such as EC2 nodes deployed to the same availability zone. | ||
|
|
||
| ```yaml | ||
| 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 | ||
|
|
||
| Pod anti-affinity is used to schedule replicas of data services to different nodes to ensure high availability. By default, the scheduling is required (hard anti-affinity). | ||
|
|
||
| ```yaml | ||
| 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 data service components | ||
| - **Components affected**: clickhouse, elasticsearch, hbase, kafka, zookeeper, victoria-metrics, stackstate, opentelemetry-collector | ||
|
|
||
| ### 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, victoria-metrics, hbase components, elasticsearch | ||
|
|
||
| ## Example Configurations | ||
|
|
||
| ### Basic Node Affinity (Same Availability Zone) + Pod Anti-Affinity for HA Deployment | ||
| ```yaml | ||
| 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 | ||
|
|
||
| # Ensure replicas are distributed across different nodes | ||
| podAntiAffinity: | ||
| requiredDuringSchedulingIgnoredDuringExecution: true | ||
| topologyKey: "kubernetes.io/hostname" | ||
| ``` | ||
|
|
||
| ## 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`: | ||
|
|
||
| ```yaml | ||
| affinity: | ||
| nodeAffinity: | ||
| requiredDuringSchedulingIgnoredDuringExecution: | ||
| nodeSelectorTerms: | ||
| - matchExpressions: | ||
| - key: topology.kubernetes.io/zone | ||
| operator: In | ||
| values: | ||
| - us-west-2a | ||
| podAntiAffinity: | ||
| requiredDuringSchedulingIgnoredDuringExecution: true | ||
| topologyKey: "kubernetes.io/hostname" | ||
| ``` | ||
|
|
||
| ### Step 2: Generate Affinity Template Values | ||
|
|
||
| Run the following command to generate the affinity values template: | ||
|
|
||
| ```text | ||
| 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: | ||
|
|
||
| ```bash | ||
| 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 | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a new file. To get it published using Gitbook it needs to be included somewhere in the
SUMMARY.md. But I guess, now that this needs to be moved to the new docs-site, things will be different but I would expect the file still needs to be added to the sidebar.