-
Notifications
You must be signed in to change notification settings - Fork 22
feat: add exhaust node resources fault #329
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
Open
preespp
wants to merge
11
commits into
itbench-hub:main
Choose a base branch
from
preespp:feat/new-fault-exhaust-node-resources
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+207
−0
Open
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
809124d
Found Typo While Setting Up Remote Cluster
preespp 0336435
feat: new fault exhaust node resources
preespp 3cfc578
Fix: obscure node label and ensure workload anti-affinity for resourc…
preespp 6f6b9b8
restructure inject & remove, change to chaos mesh and change incident…
preespp e29737d
Ignore CPUSpend Alert
preespp e5f059e
Fix Lint playbooks
preespp d3370f7
Fix Naming to match rules
preespp be4b64f
Fix whitespace
preespp 845ccb5
Merge branch 'itbench-hub:main' into feat/new-fault-exhaust-node-reso…
preespp 2d0a5b5
Update Format of incident
preespp 3ac9095
save change but need to recheck chaos mesh and inject/remove files (u…
preespp 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
51 changes: 51 additions & 0 deletions
51
sre/roles/faults/tasks/inject_custom_exhaust_node_resources.yaml
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,51 @@ | ||
| --- | ||
| - name: Get pods for target workload | ||
| kubernetes.core.k8s_info: | ||
| kubeconfig: "{{ faults_cluster.kubeconfig }}" | ||
| kind: Pod | ||
| namespace: "{{ spec.workload.namespace }}" | ||
| label_selectors: | ||
| - app.kubernetes.io/name={{ spec.workload.name }} | ||
| register: workload_pods | ||
|
|
||
| - name: Select node hosting target workload | ||
| set_fact: | ||
Red-GV marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| target_node: "{{ workload_pods.resources[0].spec.nodeName }}" | ||
|
|
||
| - name: Label the node as target for resource hog | ||
| kubernetes.core.k8s: | ||
| kubeconfig: "{{ faults_cluster.kubeconfig }}" | ||
| resource_definition: | ||
| apiVersion: v1 | ||
| kind: Node | ||
| metadata: | ||
| name: "{{ target_node }}" | ||
| labels: | ||
| node-role.kubernetes.io/app: "true" | ||
Red-GV marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| state: present | ||
Red-GV marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| - name: Deploy resource hog on target node | ||
| kubernetes.core.k8s: | ||
| kubeconfig: "{{ faults_cluster.kubeconfig }}" | ||
| resource_definition: | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: fake-resource-hog | ||
| namespace: "{{ spec.workload.namespace }}" | ||
| spec: | ||
| replicas: 1 | ||
| selector: | ||
| matchLabels: | ||
| app: fake-resource-hog | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: fake-resource-hog | ||
| spec: | ||
| nodeSelector: | ||
| node-role.kubernetes.io/app: "true" | ||
| containers: | ||
| - name: stress-container | ||
| image: progrium/stress | ||
Red-GV marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| args: ["--cpu", "8", "--io", "4", "--vm", "2", "--vm-bytes", "512M"] | ||
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
26 changes: 26 additions & 0 deletions
26
sre/roles/faults/tasks/remove_custom_exhaust_node_resources.yaml
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,26 @@ | ||
| --- | ||
| - name: Get nodes labeled as target for resource hog | ||
| kubernetes.core.k8s_info: | ||
| kubeconfig: "{{ faults_cluster.kubeconfig }}" | ||
| kind: Node | ||
| label_selectors: | ||
| - node-role.kubernetes.io/app=true | ||
| register: node_list | ||
|
|
||
| - name: Select the node labeled for this fault | ||
| set_fact: | ||
| target_node: "{{ (node_list.resources | list)[0].metadata.name }}" | ||
| when: node_list.resources | list | length > 0 | ||
|
|
||
| - name: Remove node label from target node | ||
| kubernetes.core.k8s: | ||
| kubeconfig: "{{ faults_cluster.kubeconfig }}" | ||
| resource_definition: | ||
| apiVersion: v1 | ||
| kind: Node | ||
| metadata: | ||
| name: "{{ target_node }}" | ||
| labels: | ||
| node-role.kubernetes.io/app: null | ||
| state: present | ||
| when: target_node is defined | ||
Red-GV marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
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,51 @@ | ||
| --- | ||
| fault: | ||
| - entity: | ||
| name: cart | ||
| group_id: cart | ||
| kind: Deployment | ||
| type: custom | ||
| name: exhaust-node-resources | ||
| condition: Node resource exhaustion | ||
| category: Change | ||
| fault_mechanism: exhaust-node-resources | ||
|
|
||
| alerts: | ||
| - id: CPUSpend | ||
| group_id: cluster-node-1 | ||
| metadata: | ||
| description: Node CPU usage is high due to resource exhaustion | ||
| - id: RequestLatency | ||
| group_id: cart | ||
| metadata: | ||
| description: Latency of cart deployment increases due to CPU resource contention | ||
|
|
||
| groups: | ||
| - id: cart | ||
| kind: Deployment | ||
| namespace: otel-demo | ||
| filter: | ||
| - cart.* | ||
| root_cause: true | ||
| - id: cluster-node-1 | ||
| kind: Node | ||
| namespace: kube-system | ||
| filter: | ||
| - .* | ||
|
|
||
| aliases: | ||
| - - cart | ||
| - cluster-node-1 | ||
|
|
||
| propagations: | ||
| - source: cluster-node-1 | ||
| target: cart | ||
| condition: Node resource pressure prevents new pods from being scheduled | ||
| effect: Cart deployment pods remain pending and requests may fail | ||
|
|
||
| recommended_actions: | ||
| - solution: | ||
| id: rebalance_or_scale | ||
| actions: | ||
| - Rebalance workloads to another node | ||
| - Scale up cluster node capacity |
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,27 @@ | ||
| metadata: | ||
| complexity: Medium | ||
| id: 297 | ||
Red-GV marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| name: Exhaust Node Resources | ||
| platform: kubernetes | ||
|
|
||
| spec: | ||
| environment: | ||
| applications: | ||
| otel_demo: | ||
| enabled: true | ||
| tools: | ||
| category: sre | ||
| selected: | ||
| - prometheus | ||
| - grafana | ||
| - jaeger | ||
| - chaos-mesh | ||
|
|
||
| faults: | ||
| - custom: | ||
| name: exhaust-node-resources | ||
| exhaust_node_resources: | ||
| workload: | ||
| kind: Deployment | ||
| name: cart | ||
| namespace: "{{ applications_helm_releases.otel_demo.namespace }}" | ||
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.
Uh oh!
There was an error while loading. Please reload this page.