Skip to content

Instantly share code, notes, and snippets.

@ocuil
Created November 21, 2023 13:31
Show Gist options
  • Save ocuil/c7586e5c15c121429fb92a3bf030f68c to your computer and use it in GitHub Desktop.
Save ocuil/c7586e5c15c121429fb92a3bf030f68c to your computer and use it in GitHub Desktop.
How to run ES Rally as k8s Job
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: rally-benchmarks-volume
spec:
storageClassName: "standard"
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Gi
---
apiVersion: batch/v1
kind: Job
metadata:
name: esrally
namespace: default
spec:
template:
spec:
securityContext:
fsGroup: 1000
runAsUser: 1000
runAsGroup: 1000
containers:
- name: esrally
image: elastic/rally:latest
resources:
requests:
memory: 1Gi
cpu: 100m
command:
- sh
- -c
- |
esrally list tracks && sed -i "s;/rally/.rally/benchmarks;/mnt/elastic-internal/rally-benchmarks;g" /rally/.rally/rally.ini;
CLIENT_OPTIONS="use_ssl:true,verify_certs:false,basic_auth_user:'USER',basic_auth_password:'PASSWORD'"
esrally race --track=http_logs --track-params=/rally/config/params-file.json --pipeline=benchmark-only --target-hosts=HOST:PORT --client-options=$CLIENT_OPTIONS
volumeMounts:
- name: rally-benchmarks
mountPath: "/mnt/elastic-internal/rally-benchmarks"
- name: rally-params-file
mountPath: "/rally/config/"
volumes:
- name: rally-benchmarks
persistentVolumeClaim:
claimName: rally-benchmarks-volume
- name: rally-params-file
configMap:
name: rally-params-file
restartPolicy: Never
---
apiVersion: v1
kind: ConfigMap
metadata:
name: rally-params-file
namespace: default
data:
params-file.json: |
{
"number_of_replicas": 1,
"number_of_shards": 3
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment