This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Node Scenarios

This scenario disrupts the node(s) matching the label on a Kubernetes/OpenShift cluster.

1 - Node Scenarios using Krkn

The following node chaos scenarios are supported:

  1. node_start_scenario: Scenario to stop the node instance.
  2. node_stop_scenario: Scenario to stop the node instance.
  3. node_stop_start_scenario: Scenario to stop and then start the node instance. Not supported on VMware.
  4. node_termination_scenario: Scenario to terminate the node instance.
  5. node_reboot_scenario: Scenario to reboot the node instance.
  6. stop_kubelet_scenario: Scenario to stop the kubelet of the node instance.
  7. stop_start_kubelet_scenario: Scenario to stop and start the kubelet of the node instance.
  8. restart_kubelet_scenario: Scenario to restart the kubelet of the node instance.
  9. node_crash_scenario: Scenario to crash the node instance.
  10. stop_start_helper_node_scenario: Scenario to stop and start the helper node and check service status.

AWS

Cloud setup instructions can be found here. Sample scenario config can be found here.

Baremetal

Sample scenario config can be found here.

Docker

The Docker provider can be used to run node scenarios against kind clusters.

kind is a tool for running local Kubernetes clusters using Docker container “nodes”.

kind was primarily designed for testing Kubernetes itself, but may be used for local development or CI.

GCP

Cloud setup instructions can be found here. Sample scenario config can be found here.

Openstack

How to set up Openstack cli to run node scenarios is defined here.

The supported node level chaos scenarios on an OPENSTACK cloud are node_stop_start_scenario, stop_start_kubelet_scenario and node_reboot_scenario.

To execute the scenario, ensure the value for ssh_private_key in the node scenarios config file is set with the correct private key file path for ssh connection to the helper node. Ensure passwordless ssh is configured on the host running Kraken and the helper node to avoid connection errors.

Azure

Cloud setup instructions can be found here. Sample scenario config can be found here.

Alibaba

How to set up Alibaba cli to run node scenarios is defined here.

VMware

How to set up VMware vSphere to run node scenarios is defined here

This cloud type uses a different configuration style, see actions below and example config file

  • vmware-node-terminate
  • vmware-node-reboot
  • vmware-node-stop
  • vmware-node-start

IBMCloud

How to set up IBMCloud to run node scenarios is defined here

This cloud type uses a different configuration style, see actions below and example config file

  • ibmcloud-node-terminate
  • ibmcloud-node-reboot
  • ibmcloud-node-stop
  • ibmcloud-node-start

General

Use ‘generic’ or do not add the ‘cloud_type’ key to your scenario if your cluster is not set up using one of the current supported cloud types.

2 - Node Scenarios using Krkn-Hub

This scenario disrupts the node(s) matching the label on a Kubernetes/OpenShift cluster. Actions/disruptions supported are listed here

Run

If enabling Cerberus to monitor the cluster and pass/fail the scenario post chaos, refer docs. Make sure to start it before injecting the chaos and set CERBERUS_ENABLED environment variable for the chaos injection container to autoconnect.

$ podman run --name=<container_name> --net=host --env-host=true -v <path-to-kube-config>:/home/krkn/.kube/config:Z -d quay.io/krkn-chaos/krkn-hub:node-scenarios
$ podman logs -f <container_name or container_id> # Streams Kraken logs
$ podman inspect <container-name or container-id> --format "{{.State.ExitCode}}" # Outputs exit code which can considered as pass/fail for the scenario
$ docker run $(./get_docker_params.sh) --name=<container_name> --net=host -v <path-to-kube-config>:/home/krkn/.kube/config:Z -d quay.io/krkn-chaos/krkn-hub:node-scenarios
OR 
$ docker run -e <VARIABLE>=<value> --net=host -v <path-to-kube-config>:/home/krkn/.kube/config:Z -d quay.io/krkn-chaos/krkn-hub:node-scenarios

$ docker logs -f <container_name or container_id> # Streams Kraken logs
$ docker inspect <container-name or container-id> --format "{{.State.ExitCode}}" # Outputs exit code which can considered as pass/fail for the scenario

Supported parameters

The following environment variables can be set on the host running the container to tweak the scenario/faults being injected:

example: export <parameter_name>=<value>

See list of variables that apply to all scenarios here that can be used/set in addition to these scenario specific variables

ParameterDescriptionDefault
ACTIONAction can be one of the followingnode_stop_start_scenario for aws and vmware-node-reboot for vmware, ibmcloud-node-reboot for ibmcloud
LABEL_SELECTORNode label to targetnode-role.kubernetes.io/worker
NODE_NAMENode name to inject faults in case of targeting a specific node; Can set multiple node names separated by a comma""
INSTANCE_COUNTTargeted instance count matching the label selector1
RUNSIterations to perform action on a single node1
CLOUD_TYPECloud platform on top of which cluster is running, supported platforms - aws, vmware, ibmcloud, bmaws
TIMEOUTDuration to wait for completion of node scenario injection180
DURATIONDuration to stop the node before running the start action - not supported for vmware and ibm cloud type120
VERIFY_SESSIONOnly needed for vmware - Set to True if you want to verify the vSphere client session using certificatesFalse
SKIP_OPENSHIFT_CHECKSOnly needed for vmware - Set to True if you don’t want to wait for the status of the nodes to change on OpenShift before passing the scenarioFalse
BMC_USEROnly needed for Baremetal ( bm ) - IPMI/bmc username""
BMC_PASSWORDOnly needed for Baremetal ( bm ) - IPMI/bmc password""
BMC_ADDROnly needed for Baremetal ( bm ) - IPMI/bmc username""

For example:

$ podman run --name=<container_name> --net=host --env-host=true -v <path-to-custom-metrics-profile>:/home/krkn/kraken/config/metrics-aggregated.yaml -v <path-to-custom-alerts-profile>:/home/krkn/kraken/config/alerts -v <path-to-kube-config>:/home/krkn/.kube/config:Z -d quay.io/krkn-chaos/krkn-hub:container-scenarios 

The following environment variables need to be set for the scenarios that requires intereacting with the cloud platform API to perform the actions:

Amazon Web Services

$ export AWS_ACCESS_KEY_ID=<>
$ export AWS_SECRET_ACCESS_KEY=<>
$ export AWS_DEFAULT_REGION=<>

VMware Vsphere

$ export VSPHERE_IP=<vSphere_client_IP_address>

$ export VSPHERE_USERNAME=<vSphere_client_username>

$ export VSPHERE_PASSWORD=<vSphere_client_password>

Ibmcloud

$ export IBMC_URL=https://<region>.iaas.cloud.ibm.com/v1

$ export IBMC_APIKEY=<ibmcloud_api_key>

Baremetal

$ export BMC_USER=<bmc/IPMI user>
$ export BMC_PASSWORD=<bmc/IPMI password>
$ export BMC_ADDR=<bmc address>

Google Cloud Platform

TBD

Azure

$ export AZURE_TENANT_ID=<>
$ export AZURE_CLIENT_SECRET=<>
$ export AZURE_CLIENT_ID=<>

OpenStack

TBD

Demo

You can find a link to a demo of the scenario here