Kubernetes
probe Pod

# count_pods

Count the number of pods matching the given selector

Run it now
View details

Type | probe
Module | chaosk8s.pod.probes
Name | count_pods
Return | integer

Usage

JSON

    {
      "name": "count-pods",
      "type": "probe",
      "provider": {
        "type": "python",
        "module": "chaosk8s.pod.probes",
        "func": "count_pods",
        "arguments": {
          "label_selector": ""
        }
      }
    }

YAML

    name: count-pods
    provider:
      arguments:
        label_selector: ""
      func: count_pods
      module: chaosk8s.pod.probes
      type: python
    type: probe

Arguments

Name | Type | Default | Required | Title | Description
--- | --- | --- | --- | --- | ---
ns | string | ”default” | Yes | Namespace |
label_selector | string | null | Yes | Label Selector | Selectors to target the appropriate pods
phase | string | null | No | Pod Phase | Pod phase as defined by Kubernetes. If not provided, count all pods no matter their phase

Signature

    def count_pods(label_selector: str,
                   phase: str = None,
                   ns: str = 'default',
                   secrets: Dict[str, Dict[str, str]] = None) -> int:
        pass

## Related starters

- Kubernetes
  probe Pod

  ## `pods_in_phase`

  Lookup a pod by `label_selector` in the namespace `ns`
- Kubernetes
  probe Pod

  ## `count_min_pods`

  Ensure there is a minimal required number of pods in a giving phase
- Kubernetes
  action Pod

  ## `exec_in_pods`

  Execute a command in the specified pod's container