Benchmark and Validate Kubernetes HTTP Services¶
Benchmark, and validate an HTTP service inside a Kubernetes cluster using the load-test-http
experiment. The experiment is run inside the cluster. The HTTP service may be externally exposed or local to the cluster.
Before you begin
- Try the basic
load-test-http
tutorial. - Ensure that you have a Kubernetes cluster and the
kubectl
CLI. You may run a local Kubernetes cluster using tools like Kind or Minikube. - Deploy the sample HTTP service in the Kubernetes cluster.
kubectl create deploy httpbin --image=kennethreitz/httpbin --port=80 kubectl expose deploy httpbin --port=80
Launch experiment¶
Launch a load-test-http
experiment inside the Kubernetes cluster. Note that the HTTP URL in this experiment is http://httpbin.default
, which refers to a hostname inside the Kubernetes cluster, specifically, the httpbin
service in the default
namespace.
iter8 k launch -c load-test-http \
--set url=http://httpbin.default \
--set SLOs.http/latency-mean=50 \
--set ready.deploy=httpbin \
--set ready.service=httpbin \
--set ready.timeout=60s
Kubernetes experiments and iter8 k
Notice the iter8 k launch
invocation above. Many Iter8 subcommands like launch
, assert
and report
come in two flavors, one suited for experiments that are run locally, and another suited for experiments run inside a Kubernetes cluster.
For example, iter8 launch
executes local experiments and iter8 assert
enables assertions on the results of local experiments; similarly, iter8 k launch
executes Kubernetes experiments and iter8 k assert
enables assertions on the results of Kubernetes experiments.
Notice also the additional options ready.deploy
and ready.service
which allow you to specify Kubernetes Deployment
and Service
resources that should be checked for readiness before proceeding with the load test. ready.timeout
specifies how long it should wait for the resource to be ready.
Assert experiment outcomes¶
Assert that the experiment completed without failures, and all SLOs are satisfied. The timeout flag below specifies a period of 120 sec for assert conditions to be satisfied.
iter8 k assert -c completed -c nofailure -c slos --timeout 120s
View experiment report¶
iter8 k report
iter8 k report -o html > report.html # view in a browser
View experiment logs¶
Fetch logs for the Kubernetes experiment.
iter8 k log
Set parameter values¶
All the parameters described in the basic usage (iter8 launch
) of load-test-http
are also applicable for the Kubernetes usage (iter8 k launch
) of the load-test-http
experiment.
Cleanup¶
Delete all resources pertaining to this experiment from the Kubernetes cluster.
iter8 k delete