Search⌘ K
AI Features

Running One-Shot Experiments

Explore how to execute one-shot chaos engineering experiments inside a Kubernetes cluster by defining and managing Jobs. Learn to deploy experiments using container images, monitor pod status, inspect logs, and clean up resources efficiently.

For now, we’re going to focus on one-shot experiments that we’ll run manually, or through pipelines, or any other means that we might see fit.

Inspecting the once.yaml file

Let’s take a look at yet another Kubernetes YAML file.

Shell
cat k8s/chaos/once.yaml

The output is as follows.

---

apiVersion: batch/v1
kind: Job
metadata:
  name: go-demo-8-chaos
spec:
  activeDeadlineSeconds: 600
  backoffLimit: 0
  template:
    metadata:
      labels:
        app: go-demo-8-chaos
      annotations:
        sidecar.istio.io/inject: "false"
    spec:
      serviceAccountName: chaostoolkit
      restartPolicy: Never
      containers:
      - name: chaostoolkit
        image: vfarcic/chaostoolkit:1.4.1-2
        args:
        - --verbose
        - run
        - /experiment/health-http.yaml
        env:
        - name: CHAOSTOOLKIT_IN_POD
          value: "true"
        volumeMounts:
        - name: config
          mountPath: /experiment
          readOnly: true
        resources:
          limits:
            cpu: 20m
...