Skip to main content

Container Probe

Last updated on

Container probe executes commands inside a new container and validates the output. Unlike the Command probe which runs inside the experiment pod (inline mode) or a simple source pod, the Container probe gives you full control over the container specification - image, volumes, security context, resource limits, and more.

info

Container probe is only supported on Kubernetes infrastructure driven by Harness Delegate (Kubernetes HD).

When to use

  • Run validation commands that require a specific container image with pre-installed tools (e.g., database clients, custom SDKs)
  • Execute checks that need mounted volumes, secrets, or ConfigMaps from the cluster
  • Validate application state where the command needs specific security contexts, resource limits, or service account permissions
  • Perform checks that must run with specific node affinity, tolerations, or network access

Steps to configure

  1. Navigate to Project Settings > Chaos Probes and click + New Probe

  2. Select Container Probe and provide a name, and optionally a description and tags

  3. Under Variables, define any reusable values you want to reference in probe properties or run properties. For each variable, specify the type (String or Number), name, value (fixed or runtime input), and whether it's required at runtime.

  4. Under Probe Properties, configure:

    FieldDescription
    Container ImageThe image to use (e.g., bitnami/kubectl:latest)
    CommandThe command to execute (e.g., /bin/sh, -c)
    ArgumentsThe script or arguments to pass (e.g., echo "Hello World")
    Environment Variables (optional)Name-value pairs passed to the container
    NamespaceTarget Kubernetes namespace (e.g., default)
    Image Pull PolicyIfNotPresent, Always, or Never

    Advanced Configuration (optional):

    FieldDescription
    Service Account NameService account for the probe pod (e.g., default)
    Image Pull SecretsSecrets for pulling private container images
    LabelsKey-value labels for the probe pod
    AnnotationsKey-value annotations for the probe pod
    Node SelectorKey-value pairs to constrain pod scheduling
    TolerationsTolerations for node taints
    Required/Preferred Node AffinityNode affinity rules for pod scheduling
    Resource LimitsLimit Memory and Limit CPU for the container
    Resource RequestsRequest Memory and Request CPU for the container

    Volumes (optional):

    FieldDescription
    NameVolume name (e.g., my-volume)
    TypeVolume type (e.g., EmptyDir)
    MediumStorage medium for EmptyDir
    Size LimitMaximum size (e.g., 1Gi)

    Volume Mounts (optional):

    FieldDescription
    NameVolume name to mount
    Mount PathPath inside the container (e.g., /mnt/data)
    Sub Path / Sub Path ExpressionSubpath within the volume
    Mount PropagationMount propagation mode
    Read OnlyWhether the mount is read-only

    Security Configuration (optional):

    FieldDescription
    Host Network, HostPID, Host IPCToggle access to host namespaces
    Allow Privilege EscalationAllow container process to gain more privileges
    Read Only Root FilesystemMount root filesystem as read-only
    PrivilegedRun container in privileged mode
    Run As Non RootRequire the container to run as a non-root user
    Run as user / Run as groupUID/GID for the container process (e.g., 1000)
    FS GroupFilesystem group for volumes (e.g., 2000)

    Data Comparison:

    FieldDescription
    TypeData type of the output: String, Int, or Float
    Comparison CriteriaComparison operator: matches, ==, !=, >, <, >=, <=
    ValueThe expected value to compare against (e.g., Hello World)
  5. Provide the Run Properties:

    FieldDescription
    TimeoutMaximum time for probe execution (e.g., 10s)
    IntervalTime between successive executions (e.g., 2s)
    AttemptNumber of retry attempts (e.g., 1)
    Polling IntervalTime between retries (e.g., 30s)
    Initial DelayDelay before first execution (e.g., 5s)
    VerbosityLog detail level
    Stop On Failure (optional)Stop the experiment if the probe fails
  6. Click Create Probe