Investigation & Containment

Investigation

Four questions, in this order: does the tool run at all, what can it reach, what did users see, and how do you stop it. Every command names the cluster with --context (Chapter 01).

  1. Does the monkey run? Its schedule, whether it is suspended, and the image it uses:

    kubectl --context kind-sre-control-plane -n flux-system get cronjob chaos-monkey \
      -o jsonpath='{.spec.suspend} {.spec.schedule} {.spec.jobTemplate.spec.template.spec.containers[0].image}{"\n"}'
    kubectl --context kind-sre-control-plane -n flux-system get jobs,pods -l app.kubernetes.io/name=chaos-monkey
    

    true, the schedule, an image pinned by digest - and the monkey’s Jobs and their pods, with their status. In the story, the image tag did not exist: every run failed before it started, and “nothing happened” meant “nothing ran”.

  2. What can it reach? Ask the API server as the monkey’s ServiceAccount - and let admission answer too (--dry-run=server runs it without deleting anything):

    kubectl --context kind-sre-control-plane -n develop delete pod app-postgres-1 \
      --as=system:serviceaccount:flux-system:chaos-monkey --dry-run=server
    

    Refused by the admission policy chaos-monkey-targets: the monkey may delete only frontend and backend pods. RBAC alone could not say that - a Role cannot select by label, and the monkey’s Role allows deleting any pod in develop. In the story the limit was only in the script.

  3. What did users see? Not kubectl get pods, and not the absence of alerts. A probe that sends requests through the Service - before, during and after the fault - and prints every failure with its time. The outage is the time from the first failure to the first success after it.

  4. How do you stop it? suspend: true stops future runs; a Job already running goes on. The full stop is three steps: suspend, delete the active Job, check that no Job or pod of the monkey is left.

The root cause is not too little chaos. It is chaos that was never an experiment: no hypothesis, no measurement, limits the tool could override, and a stop that did not stop.

Containment

  1. Stop it fully - suspend, delete the active Job, check that nothing is left.
  2. Check the service - the probe, not the pod list: requests succeed again.
  3. Put the limits where the cluster enforces them - RBAC for the namespace, an admission policy for the targets, the schedule and the window in Git.
  4. Restart as an experiment - one fault, a written hypothesis, a probe, a stop condition, a comparison.

Chaos is an experiment: predict, cause one fault, measure what users get, compare - with limits the tool cannot override and a stop that really stops.


Pause and Predict: A pod deletion is over in seconds. Which of the platform’s safety nets - the ReplicaSet, the HPA, the PodDisruptionBudget - does it actually test?