IBM / k8s-storage-perf

This git repo will host the playbooks for collecting performance metrics for a Kubernetes persistent storage for IBM Cloud Paks
Apache License 2.0
9 stars 18 forks source link

K8s Storage Performance

Ansible playbooks to collect Storage performance metrics on an OpenShift cluster.

Note that: to assess if a storage provider, especially for new storage, is suitable to support ReadWriteOnce and ReadWriteMany volumes for your Cloud Pak workloads or not, check out this project at https://github.com/IBM/k8s-storage-tests, and perform the storage readiness tests provided there. It will give you a good assessment of the particular storage.

Prerequisites

Setup

Running the Playbook

Pulling and loading the required image in airgap environment

This storage performance test suite relies on a container image: quay.io/ibm-cp4d-public/xsysbench:1.1 This image may not be directly accessible on an aigap cluster. To resolve this, follow the steps below to download the image onto an intermediary host and then copy the image to the airgap cluster, and finally load it into the cluster's private registry.

 # on an intermediary host that can access the image
 podman pull quay.io/ibm-cp4d-public/xsysbench:1.1
 podman save -o xsysbench-1.1.tar quay.io/ibm-cp4d-public/xsysbench:1.1

 # copy the above .tar file onto the airgap cluster

 # on the airgap cluster
 podman load -i xsysbench-1.1.tar
 podman tag quay.io/ibm-cp4d-public/xsysbench:1.1 <private-registry>/ibm-cp4d-public/xsysbench:1.1
 podman tag quay.io/ibm-cp4d-public/xsysbench:1.1 <private-registry>/ibm-cp4d-public/xsysbench:1.1-amd64

 podman login -u <uaername> -p <password> <private-registry> --tls-verify=false

 podman push <private-registry>/ibm-cp4d-public/xsysbench:1.1
 podman push <private-registry>/ibm-cp4d-public/xsysbench:1.1-amd64

Next make sure that in the "params.yml" file, you modify the imageurl line to below:

imageurl: <private-registry>/ibm-cp4d-public/xsysbench:1.1

Finally just follow the previous sections to run the test suites.

Running the Playbook with the Container

Environment Setup

export dockerexe=podman # or docker
export container_name=k8s-storage-perf
export docker_image=icr.io/cpopen/cpd/k8s-storage-perf:v1.0.0

alias k8s_storage_perf_exec="${dockerexe} exec ${container_name}"
alias run_k8s_storage_perf="k8s_storage_perf_exec ansible-playbook main.yml --extra-vars \"@/tmp/work-dir/params.yml\" | tee output.log"
alias run_k8s_storage_perf_cleanup="k8s_storage_perf_exec cleanup.sh -n ${NAMESPACE} -d"

Start the Container

mkdir -p /tmp/k8s_storage_perf/work-dir
cp ./params.yml /tmp/k8s_storage_perf/work-dir/params.yml

${dockerexe} pull ${docker_image}
${dockerexe} run --name ${container_name} -d -v /tmp/k8s_storage_perf/work-dir:/tmp/work-dir ${docker_image}

Run the Playbook

run_k8s_storage_perf

Then to view the results:

mkdir /tmp/k8s_storage_perf/work-dir/data
${dockerexe} cp ${container_name}:/opt/ansible/storage-perf.tar /tmp/k8s_storage_perf/work-dir/data/storage-perf.tar
tar -xvf /tmp/k8s_storage_perf/work-dir/data/storage-perf.tar -C /tmp/k8s_storage_perf/work-dir/data

ls -l /tmp/k8s_storage_perf/work-dir/data
-rw-r--r-- 1 1001 root   190 Aug  2 17:18 jobs.csv
-rw-r--r-- 1 1001 root  5615 Aug  2 17:18 nodes.csv
-rw-r--r-- 1 1001 root   952 Aug  2 17:18 params.log
-rw-r--r-- 1 1001 root   484 Aug  2 17:18 pods.csv
-rw-r--r-- 1 1001 root  1453 Aug  2 17:18 result.csv
-rw-r--r-- 1 root root 20480 Aug  2 17:18 storage-perf.tar

Optional Cleanup the Cluster

run_k8s_storage_perf_cleanup

[INFO ] running clean up for namespace storage-validation-1 and the namespace will be deleted
[INFO ] please run the following command in a terminal that has access to the cluster to clean up after the ansible playbooks

oc get job -n storage-validation-1 -o name | xargs -I % -n 1 oc delete % -n storage-validation-1 && \
oc get pvc -n storage-validation-1 -o name | xargs -I % -n 1 oc delete % -n storage-validation-1 && \
oc get cm -n storage-validation-1 -o name | xargs -I % -n 1 oc delete % -n storage-validation-1 && \
oc delete ns storage-validation-1 --ignore-not-found

[INFO ] cleanup script finished with no errors

Clean-up Resources

With each run, delete the kuberbetes namespace that you created in Setup, you can delete the project

export STORAGE_PERF_NAMESPACE=<storage_perf_namespace>
oc delete project ${STORAGE_PERF_NAMESPACE}

OR delete the resources in the project individually

export STORAGE_PERF_NAMESPACE=<storage_perf_namespace>
oc delete job $(oc get jobs -n ${STORAGE_PERF_NAMESPACE} | grep -Ev NAME | awk '{ print $1 }') -n ${STORAGE_PERF_NAMESPACE}
oc delete pvc $(oc get pvc -n ${STORAGE_PERF_NAMESPACE} | grep -Ev NAME | awk '{ print $1 }') -n ${STORAGE_PERF_NAMESPACE}
# optionally
oc delete project ${STORAGE_PERF_NAMESPACE}