---
id: container-kill
title: Container Kill Experiment Details
sidebar_label: Container Kill
original_id: container-kill
---
---
## Experiment Metadata
| Variables |
Description |
Specify In ChaosEngine |
Notes |
| TARGET_CONTAINER |
The container to be killed inside the pod |
Mandatory |
If the TARGET_CONTAINER is not provided it will delete the first container |
| CHAOS_INTERVAL |
Time interval b/w two successive container kill (in sec) |
Optional |
If the CHAOS_INTERVAL is not provided it will take the default value of 10s |
| TOTAL_CHAOS_DURATION |
The time duration for chaos injection (seconds) |
Optional |
Defaults to 20s |
| PODS_AFFECTED_PERC |
The Percentage of total pods to target |
Optional |
Defaults to 0 (corresponds to 1 replica), provide numeric value only |
| TARGET_PODS |
Comma separated list of application pod name subjected to container kill chaos |
Optional |
If not provided, it will select target pods randomly based on provided appLabels |
| LIB_IMAGE |
LIB Image used to kill the container |
Optional |
Defaults to `litmuschaos/go-runner:1.11.0` |
| LIB |
The category of lib use to inject chaos |
Optional |
Default value: litmus, supported values: pumba and litmus |
| RAMP_TIME |
Period to wait before injection of chaos in sec |
Optional |
|
| SEQUENCE |
It defines sequence of chaos execution for multiple target pods |
Optional |
Default value: parallel. Supported: serial, parallel |
| SOCKET_PATH |
Path of the containerd/crio/docker socket file |
Optional |
Defaults to `/var/run/docker.sock` |
| CONTAINER_RUNTIME |
container runtime interface for the cluster |
Optional |
Defaults to docker, supported values: docker, containerd and crio for litmus and only docker for pumba LIB |
| INSTANCE_ID |
A user-defined string that holds metadata/info about current run/instance of chaos. Ex: 04-05-2020-9-00. This string is appended as suffix in the chaosresult CR name. |
Optional |
Ensure that the overall length of the chaosresult CR is still < 64 characters |
#### Sample ChaosEngine Manifest
[embedmd]: # "https://raw.githubusercontent.com/litmuschaos/chaos-charts/v1.11.x/charts/generic/container-kill/engine.yaml yaml"
```yaml
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: nginx-chaos
namespace: default
spec:
# It can be true/false
annotationCheck: "true"
# It can be active/stop
engineState: "active"
appinfo:
appns: "default"
applabel: "app=nginx"
appkind: "deployment"
chaosServiceAccount: container-kill-sa
monitoring: false
# It can be delete/retain
jobCleanUpPolicy: "delete"
experiments:
- name: container-kill
spec:
components:
env:
# provide the chaos interval
- name: CHAOS_INTERVAL
value: "10"
# provide the total chaos duration
- name: TOTAL_CHAOS_DURATION
value: "20"
# provide the name of container runtime
# for litmus LIB, it supports docker, containerd, crio
# for pumba LIB, it supports docker only
- name: CONTAINER_RUNTIME
value: "docker"
# provide the socket file path
- name: SOCKET_PATH
value: "/var/run/docker.sock"
```
### Create the ChaosEngine Resource
- Create the ChaosEngine manifest prepared in the previous step to trigger the Chaos.
`kubectl apply -f chaosengine.yml`
- If the chaos experiment is not executed, refer to the [troubleshooting](https://docs.litmuschaos.io/docs/faq-troubleshooting/)
section to identify the root cause and fix the issues.
### Watch Chaos progress
- View pod restart count by setting up a watch on the pods in the application namespace
`watch -n 1 kubectl get pods -n