Skip to content

Files

Latest commit

 

History

History
248 lines (236 loc) · 7.04 KB

File metadata and controls

248 lines (236 loc) · 7.04 KB
title sidebar_position
Kubernetes Probe
5

With the proliferation of custom resources & operators, especially in the case of stateful applications, the steady-state is manifested as status parameters/flags within Kubernetes resources. K8s Probe addresses verification of the desired resource state by allowing users to define the Kubernetes GVR (group-version-resource) with appropriate filters (field selectors/label selectors). The experiment makes use of the Kubernetes Dynamic Client to achieve this. The probe supports following CRUD operations:

  • create: It creates kubernetes resource based on the data provided inside probe.data field.
  • delete: It deletes matching kubernetes resource via GVR and filters (field selectors/label selectors).
  • present: It checks for the presence of kubernetes resource based on GVR and filters (field selectors/label selectors).
  • absent: It checks for the absence of kubernetes resource based on GVR and filters (field selectors/label selectors).

Defining the probe

You can define the probes at .spec.experiments[].spec.probe path inside the chaos engine.

kind: Workflow
apiVersion: argoproj.io/v1alpha1
spec:
  templates:
    - inputs:
        artifacts:
          - raw:
              data: |
                apiVersion: litmuschaos.io/v1alpha1
                kind: ChaosEngine
                spec:
                  experiments:
                    - spec:
                        probe:
                          ####################################
                          Probes are defined here
                          ####################################

Schema

Listed below is the probe schema for the Kubernetes probe, with properties shared across all the probes and properties unique to the Kubernetes probe.

Field Description Type Range Notes
group Flag to hold the group of the kubernetes resource for the k8sProbe Mandatory N/A type: string The group contains group of the kubernetes resource on which k8sProbe performs the specified operation.
version Flag to hold the apiVersion of the kubernetes resource for the k8sProbe Mandatory N/A type: string The version contains apiVersion of the kubernetes resource on which k8sProbe performs the specified operation
resource Flag to hold the kubernetes resource name for the k8sProbe Mandatory N/A type: string The resource contains the kubernetes resource name on which k8sProbe performs the specified operation.
namespace Flag to hold the namespace of the kubernetes resource for the k8sProbe Mandatory N/A type: string The namespace contains namespace of the kubernetes resource on which k8sProbe performs the specified operation.
fieldSelector Flag to hold the fieldSelectors of the kubernetes resource for the k8sProbe Optional N/A type: string The fieldSelector contains fieldSelector to derived the kubernetes resource on which k8sProbe performs the specified operation.
labelSelector Flag to hold the labelSelectors of the kubernetes resource for the k8sProbe Optional N/A type: string The labelSelector contains labelSelector to derived the kubernetes resource on which k8sProbe performs the specified operation.
operation Flag to hold the operation type for the k8sProbe Mandatory N/A type: string The operation contains operation which should be applied on the kubernetes resource as part of k8sProbe. It supports four type of operation. It can be one of create, delete, present, absent.

Run properties

Field Description Type Range Notes
probeTimeout Flag to hold the timeout of the probe Mandatory N/A type: integer The probeTimeout represents the time limit for the probe to execute the specified check and return the expected data
retry Flag to hold the retry count of the probe Mandatory N/A type: integer The retry contains the number of times a check is re-run upon failure in the first attempt before declaring the probe status as failed.
interval Flag to hold the interval of the probe Mandatory N/A type: integer The interval contains the interval for which probes waits between subsequent retries
probePollingInterval Flag to hold the polling interval for the probes (applicable for all modes) Optional N/A type: integer The probePollingInterval contains the time interval for which continuous probe should be sleep after each iteration
initialDelaySeconds Flag to hold the initial delay interval for the probes Optional N/A type: integer The initialDelaySeconds represents the initial waiting time interval for the probes.
stopOnFailure Flags to hold the stop or continue the experiment on probe failure Optional N/A type: boolean The stopOnFailure can be set to true/false to stop or continue the experiment execution after probe fails

Definition

probe:
  - name: "check-app-cluster-cr-status"
    type: "k8sProbe"
    k8sProbe/inputs:
      group: "<appGroup>"
      version: "<appVersion>"
      resource: "<appResource>"
      namespace: "default"
      fieldSelector: "metadata.name=<appResourceName>,status.phase=Running"
      labelSelector: "<app-labels>"
      operation: "present" # it can be present, absent, create, delete
    mode: "EOT"
    runProperties:
      probeTimeout: 5
      interval: 5
      retry: 1