KUTTL Configuration Reference

December 3, 2025 ยท View on GitHub

TestSuite

The TestSuite object specifies the settings for the entire test suite and should live in the test suite configuration file (kuttl-test.yaml by default, or --config):

apiVersion: kuttl.dev/v1beta1
kind: TestSuite
startKIND: true
kindContainers:
- your/image:latest
testDirs:
- tests/e2e/
timeout: 120
ignoreFiles:
- "*.md"
- "README*"
- ".gitignore"

Supported settings:

FieldTypeDescriptionDefault
crdDirstringPath to CRDs to install before running tests. KUTTL waits for CRDs to be available prior to starting tests.
manifestDirslist of stringsPaths to manifests to install before running tests.
testDirslist of stringsDirectories containing test cases to run.
startControlPlaneboolWhether or not to start a local etcd and kubernetes API server for the tests.false
startKINDboolWhether or not to start a local kind cluster for the tests.false
kindNodeCacheboolIf set, each node defined in the kind configuration will have a docker volume mounted into it to persist pulled container images across test runsfalse
kindConfigstringPath to the KIND configuration file to use.
kindContextstringKIND context to use."kind"
skipDeleteboolIf set, do not delete the resources after running the tests (implies SkipClusterDelete).false
skipClusterDeleteboolIf set, do not delete the mocked control plane or kind cluster.false
timeoutintOverride the default timeout of 30 seconds (in seconds).30
parallelintThe maximum number of tests to run at once.8
artifactsDirstringThe directory to output artifacts to (current working directory if not specified)..
commandslist of CommandsCommands to run prior to running the tests.[]
kindContainerslist of stringsList of Docker images to load into the KIND cluster once it is started.[]
reportFormatstringDetermines the report format. If empty, no report is generated. One of: JSON, XML.
reportGranularitystringWhat granularity to report failures at. One of: step, test.step
reportNamestringThe name of report to create. This field is not used unless reportFormat is set."kuttl-test"
namespacestringThe namespace to use for tests. This namespace will be created if it does not exist and removed if it was created (unless skipDelete is set). If no namespace is set, one will be auto-generated.
suppresslist of stringsSuppresses log collection of the specified types. Currently only events is supported.
ignoreFileslist of stringsFile patterns (e.g., *.md, README*) to ignore when collecting test steps. Files matching these patterns will not generate warnings about not matching the expected test file pattern. Setting this field (even to an empty list) overrides the defaults.["README*"]

TestStep

The TestStep object can be used to specify settings for a test step and can be specified in any test step YAML file other than the assert and errors files.

apiVersion: kuttl.dev/v1beta1
kind: TestStep
metadata:
  name: example-step
apply:
- my-new-resource.yaml
assert:
- my-asserted-new-resource.yaml
error:
- my-errored-new-resource.yaml
unitTest: false
delete:
- apiVersion: v1
  kind: Pod
  name: my-pod
commands:
- command: helm init
kubeconfig: foo.kubeconfig

Supported settings:

FieldTypeDescription
metadata.namestringStep name. If not specified, then the name of the first encountered file of the step is used.
applylist of filesA list of files to apply as part of this step. Specified path is relative to that in which the step occurs.
assertlist of filesA list of files to assert as part of this step. See documentation for asserts and errors for more information. Specified path is relative to that in which the step occurs.
errorlist of filesA list of files to error as part of this step. See documentation for asserts and errors for more information. Specified path is relative to that in which the step occurs.
deletelist of object referencesA list of objects to delete, if they do not already exist, at the beginning of the test step. The test harness will wait for the objects to be successfully deleted before applying the objects in the step.
indexintOverride the test step's index.
commandslist of CommandsCommands to run prior at the beginning of the test step.
kubeconfigstringThe Kubeconfig file to use to run the included steps(s).
kubeconfigLoadingstringSpecifies the mode for loading Kubeconfig and making a cluster connection: Eager (when loading the test definition) or Lazy (right before executing the step, makes it possible to generate the Kubeconfig in a preceding step). Defaults to Eager.
contextstringSpecifies the context to use from the Kubeconfig.
unitTestboolIndicates if the step is a unit test, safe to run without a real Kubernetes cluster.

Object Reference:

FieldTypeDescription
apiVersionstringThe Kubernetes API version of the objects to delete.
kindstringThe Kubernetes kind of the objects to delete.
namestringIf specified, the name of the object to delete. If not specified, all objects that match the specified labels will be deleted.
namespacestringThe namespace of the objects to delete.
labelsmapIf specified, a label selector to use when looking up objects to delete. If both labels and name are unspecified, then all resources of the specified kind in the namespace will be deleted.

TestAssert

The TestAssert object can be used to specify settings for a test step's assert and must be specified in the test step's assert YAML.

apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 30
commands:
- command: echo hello
collectors:
- type: pod
  pod: nginx
resourceRefs:
- apiVersion: apps/v1
  kind: Deployment
  namespace: kube-system
  name: coredns
  ref: coredns_deployment
assertAll:
- celExpr: "coredns_deployment.spec.replicas >= 2"

Supported settings:

FieldTypeDescriptionDefault
timeoutintNumber of seconds that the test is allowed to run for.30
collectorslist of collectorsThe collectors to be invoked to gather information upon step failure.N/A
commandslist of commandsCommands to run prior to the beginning of the test step.N/A
resourceRefslist of resource referencesReferences to resources used in the expression-based assertions.N/A
assertAlllist of ExpressionsList of expressions all must evaluate to true for a successful assertion.N/A
assertAnylist of ExpressionsList of expressions at least one of which must evaluate to true for a successful assertion.N/A

TestFile

A TestFile object can be used to provide configuration concerning a single YAML test file that contains it.

apiVersion: kuttl.dev/v1beta1
kind: TestFile
testRunSelector:
  matchLabels:
    flavor: vanilla

Supported settings:

FieldTypeDescriptionDefault
testRunSelectorlabel selectorIf this selector does not match labels of this test run, the containing file will be ignored.Empty label selector (matches all possible test label sets).

Test Run Labels and Selectors

An invocation of kuttl test may specify a label set associated with a test run using a command line flag. One can then use a TestFile object with testRunSelector to decide whether a given test YAML file should be included in a test run or not.

Collectors

The Collectors object is used by the TestAssert object as a way to collect certain information about the outcome of an assert or errors step should it fail. A collector is only invoked in cases where a failure occurs and not if the step succeeds. Collection can occur from Pod logs, Namespace events, or the output of a custom command.

Supported settings:

FieldTypeDescriptionDefault
typestringType of collector to run. Values are one of pod, command, or events. If the field named command is specified, type is assumed to be command. If the field named pod is specified, type is assumed to be pod.pod
podstringThe pod name from which to access logs.N/A
namespacestringNamespace in which the pod or events can be located.N/A
containerstringContainer name inside the pod from which to fetch logs. If empty assumes all containers.unset
selectorstringLabel query to select a pod.N/A
tailintThe number of last lines to collect from a pod.10 (if selector); all (if pod name)
commandstringCommand to run. Requires an empty type or type command. Must not specify fields pod, namespace, container, or selector if present.N/A

Commands

The Commands object is used by TestStep, TestAssert, and TestSuite to enable running commands in tests:

FieldTypeDescription
commandstringThe command and argument to run as a string.
scriptstringAllows a shell script to run - namespaced and command should not be used with script. namespaced is ignored and command is an error. env expansion is depended upon the shell but ENV is passed to the runtime env.
namespacedboolIf set, the --namespace flag will be appended to the command with the namespace to use (the test namespace for a test step or "default" for the test suite).
ignoreFailureboolIf set, failures will be ignored.
backgroundboolIf this command is to be started in the background. These are only support in TestSuites.
skipLogOutputboolIf set, the output from the command is not logged. Useful for sensitive logs or to reduce noise.
timeoutintOverride the TestSuite timeout for this command (in seconds).

Note: The current working directory (CWD) for command/script is the test directory.

Resource References

The Resource References objects are used by TestAssert for declaring identifiers for expression based assertions.

FieldTypeDescription
apiVersionstringapiVersion of the target resource.
kindstringKind of the target resource.
namespacestringNamespace of the target resource. When not specified, defaults to the namespace of the current test.
namestringName of the target resource.
refstringIdentifier for the resource used in the expressions.

Expressions

The Expressions objects are used by TestAssert for declaring expressions used in assertions.

FieldTypeDescription
celExprstringCEL Expression as per https://github.com/google/cel-spec/.