Created
April 12, 2023 01:00
-
-
Save adyanth/d589eecd0933fd65cb2da832a0265d39 to your computer and use it in GitHub Desktop.
Scheduled Stress all nodes in K8s
This file contains 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
FROM alpine | |
RUN apk add stress-ng | |
ENTRYPOINT ["stress-ng"] |
This file contains 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
apiVersion: batch/v1 | |
kind: CronJob | |
metadata: | |
name: stress | |
labels: | |
app: stress | |
spec: | |
concurrencyPolicy: Replace | |
successfulJobsHistoryLimit: 1 | |
failedJobsHistoryLimit: 1 | |
schedule: "* * * * *" # Run every minute | |
jobTemplate: | |
spec: | |
parallelism: 4 # Number of nodes | |
template: | |
metadata: | |
labels: | |
app: stress | |
spec: | |
affinity: | |
podAntiAffinity: | |
preferredDuringSchedulingIgnoredDuringExecution: | |
- podAffinityTerm: | |
topologyKey: kubernetes.io/hostname | |
labelSelector: | |
matchExpressions: | |
- key: app | |
operator: In | |
values: | |
- stress | |
weight: 100 | |
containers: | |
- name: stress | |
image: adyanth/stress-ng | |
imagePullPolicy: IfNotPresent | |
args: | |
- --cpu | |
- "1" # 1 core stress | |
- --timeout | |
- 10s # 10 sec timeout | |
restartPolicy: Never |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment