action Node

drain_nodes

Drain nodes matching the given label or name, so that no pods are scheduled on them any longer and running pods are evicted

Activity as code

Below are the details and signature of the activity Python module.

Typeaction
Modulechaosk8s.node.actions
Namedrain_nodes
Returnboolean

Usage

JSON

{
  "name": "drain-nodes",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.node.actions",
    "func": "drain_nodes"
  }
}

YAML

name: drain-nodes
provider:
  func: drain_nodes
  module: chaosk8s.node.actions
  type: python
type: action

Arguments

NameTypeDefaultRequired
namestringnullNo
label_selectorstringnullNo
delete_pods_with_local_storagebooleanfalseNo
timeoutinteger120No
countintegernullNo
pod_label_selectorstringnullNo
pod_namespacestringnullNo

This action does a similar job to kubectl drain --ignore-daemonsets or kubectl drain --delete-local-data --ignore-daemonsets if delete_pods_with_local_storage is set to True. There is no equivalent to the kubectl drain --force flag.

You probably want to call uncordon from in your experiment’s rollbacks.

Signature

def drain_nodes(name: str = None,
                label_selector: str = None,
                delete_pods_with_local_storage: bool = False,
                timeout: int = 120,
                secrets: Dict[str, Dict[str, str]] = None,
                count: int = None,
                pod_label_selector: str = None,
                pod_namespace: str = None) -> bool:
    pass