Making the Application Fault-Tolerant

In this lesson, we will learn how to make the application fault-tolerant.

How can we make the application fault-tolerant?

Now, we have a decent experiment that is validating whether our Pod is in the correct state, whether it is under the right conditions, and whether it exists. Then, it destroys the Pod, only to repeat the same validations of its state. The experiment confirms something that you should already know. Deploying a Pod by itself does not make it fault-tolerant. Pods alone are not even highly available. They’re not many things. However, what interests us, for now, is that they are not fault-tolerant. We confirmed this through the experiment.

We did something that we shouldn’t do; we deployed a Pod directly, instead of using some higher-level constructs in Kubernetes. That was intentional. I wanted to start with a few simple experiments and progress over time towards more complex ones. I promise that I will not make the same ridiculous definitions of the application in the future.

Let’s correct the situation.

We know through the experiment that our application is not fault-tolerant. When an instance of our app is destroyed, Kubernetes does not recreate a new one. So, how can we fix that? If you have any experience with Kubernetes, you should already know that we are going to make our application fault-tolerant by creating a Deployment instead of a Pod.

Inspecting the definition of deployment.yaml

Let’s take a look at a new definition.

Get hands-on with 1200+ tech skills courses.