Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/chaos-mesh/chaos-mesh/llms.txt

Use this file to discover all available pages before exploring further.

Schedule allows you to run chaos experiments on a schedule using cron expressions.

API Version and Kind

apiVersion: chaos-mesh.org/v1alpha1
kind: Schedule

Metadata

Standard Kubernetes object metadata.
metadata.name
string
required
Name of the Schedule resource.
metadata.namespace
string
Namespace of the Schedule resource. Defaults to default.

Spec Fields

spec
ScheduleSpec
required
Defines the behavior of the scheduled chaos.

ScheduleSpec

schedule
string
required
Cron expression defining when to run the chaos experiment.Supports standard cron format with optional seconds field:
  • [Second] Minute Hour DayOfMonth Month DayOfWeek
Examples:
schedule: "0 */5 * * * *"    # Every 5 minutes
schedule: "0 0 0 * * *"      # Daily at midnight
schedule: "0 30 9 * * 1-5"   # Weekdays at 9:30 AM
startingDeadlineSeconds
*int64
Deadline in seconds for starting the chaos if it misses the scheduled time.Minimum: 0 (exclusive)
startingDeadlineSeconds: 300  # 5 minutes
concurrencyPolicy
ConcurrencyPolicy
default:"Forbid"
How to treat concurrent executions of a chaos experiment.Enum values:
  • Forbid - Do not allow concurrent runs (default)
  • Allow - Allow concurrent runs
concurrencyPolicy: Forbid
historyLimit
int
default:"1"
Number of finished chaos experiments to retain for history.Minimum: 1
historyLimit: 5
type
ScheduleTemplateType
required
Type of chaos to schedule.Common values include:
  • PodChaos
  • NetworkChaos
  • StressChaos
  • IOChaos
  • TimeChaos
  • KernelChaos
  • HTTPChaos
  • DNSChaos
  • JVMChaos
  • BlockChaos
  • AWSChaos
  • GCPChaos
  • AzureChaos
  • PhysicalMachineChaos
Note: Cannot schedule Workflow type (nested workflows not supported).
ScheduleItem
ScheduleItem
required
Embedded chaos specification (inline). The actual chaos spec depends on the type field.For example, if type: PodChaos, include podChaos spec inline.

Status Fields

status
ScheduleStatus
Most recently observed status of the schedule.

ScheduleStatus

active
[]corev1.ObjectReference
List of currently running chaos experiments created by this schedule.
time
metav1.Time
Last time the schedule successfully created a chaos experiment.

Pausing a Schedule

To pause a schedule, add the annotation:
metadata:
  annotations:
    experiment.chaos-mesh.org/pause: "true"

Examples

Schedule PodChaos Daily

apiVersion: chaos-mesh.org/v1alpha1
kind: Schedule
metadata:
  name: schedule-pod-kill
  namespace: chaos-mesh
spec:
  schedule: "0 0 2 * * *"  # 2 AM daily
  type: PodChaos
  historyLimit: 3
  concurrencyPolicy: Forbid
  podChaos:
    action: pod-kill
    mode: one
    selector:
      namespaces:
        - default
      labelSelectors:
        app: nginx

Schedule NetworkChaos Every Hour

apiVersion: chaos-mesh.org/v1alpha1
kind: Schedule
metadata:
  name: schedule-network-delay
  namespace: chaos-mesh
spec:
  schedule: "0 0 * * * *"  # Every hour
  type: NetworkChaos
  historyLimit: 5
  concurrencyPolicy: Allow
  startingDeadlineSeconds: 600
  networkChaos:
    action: delay
    mode: all
    selector:
      namespaces:
        - production
      labelSelectors:
        tier: backend
    delay:
      latency: "100ms"
      correlation: "50"
    duration: "30s"

Schedule StressChaos on Weekdays

apiVersion: chaos-mesh.org/v1alpha1
kind: Schedule
metadata:
  name: schedule-cpu-stress
  namespace: chaos-mesh
spec:
  schedule: "0 30 14 * * 1-5"  # Weekdays at 2:30 PM
  type: StressChaos
  historyLimit: 2
  concurrencyPolicy: Forbid
  stressChaos:
    mode: one
    selector:
      namespaces:
        - default
      labelSelectors:
        app: worker
    stressors:
      cpu:
        workers: 2
        load: 80
    duration: "5m"