Skip to main content

Kubelet service kill

Kubelet service kill makes the application unreachable on the account of the node turning unschedulable (NotReady).

  • Kubelet service is stopped (or killed) on a node to make it unschedulable for a specific duration defined by the TOTAL_CHAOS_DURATION environment variable.
  • The application node goes back to normal state and services are resumed after the chaos duration.

Kubelet Service Kill

Usage

View the uses of the fault
This fault determines the resilience of an application when a node becomes unschedulable, i.e. NotReady state.

Prerequisites

  • Kubernetes > 1.16
  • Node specified in the TARGET_NODE environment variable (the node for which Docker service would be killed) should be cordoned before executing the chaos fault. This ensures that the fault resources are not scheduled on it (or subject to eviction). This is achieved by the following steps:
    • Get node names against the applications pods using command kubectl get pods -o wide.
    • Cordon the node using command kubectl cordon <nodename>.

Default validations

The target nodes should be in the ready state before and after injecting chaos.

Fault Tunables

Check the Fault Tunables

Mandatory Fields

Variables Description Notes
TARGET_NODE Name of the target node. For example, node-1.
NODE_LABEL It contains node label, which will be used to filter the target node if TARGET_NODE ENV is not set It is mutually exclusive with the TARGET_NODE ENV. If both are provided then it will use the TARGET_NODE.

Optional fields

Variables Description Notes
TOTAL_CHAOS_DURATION Duration that you specify, through which chaos is injected into the target resource (in seconds). Defaults to 60s.
LIB_IMAGE Image used to inject chaos. Defaults to ubuntu:16.04.
RAMP_TIME Period to wait before and after injecting chaos (in seconds). For example, 30s.

Fault examples

Common and node-specific tunables

Refer to the common attributes and node-specific tunables to tune the common tunables for all faults and node specific tunables.

Kill kubelet service

It contains the name of the target node subject to the chaos. You can tune it using the TARGET_NODE environment variable.

Use the following example to tune it:

# kill the kubelet service of the target node
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: engine-nginx
spec:
engineState: "active"
annotationCheck: "false"
chaosServiceAccount: litmus-admin
experiments:
- name: kubelet-service-kill
spec:
components:
env:
# name of the target node
- name: TARGET_NODE
value: 'node01'
- name: TOTAL_CHAOS_DURATION
VALUE: '60'