Gremlin can generate various infrastructure attacks that impact cores, workers, and memory.
Let's perform the following steps to attack the CPU:
- Deploy a sample application:
$ kubectl apply -f ./src/chapter4/gremlin/nginx.yaml
- List the pods and confirm they are running:
$ kubectl get pods |grep nginx
nginx-deployment-5c689d88bb-24n4m 1/1 Running 0 4m31s
nginx-deployment-5c689d88bb-rwtk9 1/1 Running 0 4m31s
- Get the node name for one of the pods:
$ kubectl get pod nginx-deployment-5c689d88bb-rwtk9 -o jsonpath="{.spec.nodeName}"
ip-172-20-50-43.ec2.internal
- Watch the pods status:
$ watch kubectl get pods
- Log in to your Gremlin account at https://app.gremlin.com/.
- From the Attacks menu, click on Infrastructure.
- Click on the New Attack button:
- Under the Choose Hosts to target tab, pick the node's local hostname from step 3:
- Under the Choose a Gremlin tab, click on Resource, select CPU attack, set CPU Capacity to 90, and consume all CPU cores:
- Click on Unleash Gremlin to run the attack:
Now, the actions you triggered on your Gremlin account will be executed on your cluster through the agent.