...

/

Test a Pod Failure

Test a Pod Failure

Learn how we can test a Pod failure.

We'll cover the following...

The simplest way to test a failure is to delete a Pod manually. The StatefulSet controller will notice that the observed state varies from the desired state and start a new Pod to reconcile. It will also connect it to the same PVC and volume.

Let’s test it. Use the following terminal to execute all the commands for this lesson.

Terminal 1
Terminal
Loading...

Confirm that we have three healthy Pods in our StatefulSet.

$ kubectl get pods
NAME READY STATUS AGE
tkb-sts-0 1/1 Running 12h
tkb-sts-1 1/1 Running 12h
tkb-sts-2 1/1 Running 9m49s
Get the list of Pods

Let’s delete the tkb-sts-0 Pod and see if the StatefulSet controller automatically recreates it.

$ kubectl delete pod tkb-sts-0
pod "tkb-sts-0" deleted
$ kubectl get pods --watch
NAME READY STATUS RESTARTS AGE
tkb-sts-1 1/1 Running 0 12h
tkb-sts-2 1/1 Running 0 12h
tkb-sts-0 0/1 Terminating 0 12h
tkb-sts-0 0/1 Pending 0 0s
tkb-sts-0 0/1 ContainerCreating 0 0s
tkb-sts-0 1/1 Running 0 8s
Delete the Pod and monitor the list of Pods

Placing a ...