What is self-healing in Kubernetes?

Self-healing is a feature provided by the Kubernetes open-source system.

If a containerized app or an application component fails or goes down, Kubernetes re-deploys it to retain the desired state.

Kubernetes provides self-healing by default.

Working

Kubernetes implements self-healing at the Application Layer.

This means that if your app is well containerized and a podwhere containers are placed crashes, Kubernetes will work to reschedule it as soon as possible. Containers are made available for clients only if they are ready to serve.

The redeployment is subject to the availability of sufficient infrastructure.

Through its self-healing ability, Kubernetes is able to achieve the following:

  • Restart failed containers
  • Kill containers that do not respond to client requests

To check if the pods are functioning at desired states, Kubernetes performs two probes:

  1. The liveliness probe checks the running status of a container. If the probe fails, Kubernetes terminates the container and creates a new one according to its restart policy.

  2. The readiness probe checks a container for its client request serving abilities. If the probe fails, Kubernetes will remove the IP address of the affected pod.

The self-healing cycle in Kubernetes

Advantages

  1. Self-healing in Kubernetes allows business applications to operate 24/7.

  2. Once a failed containerized app or application component is detected, which may take up to five minutes, Kubernetes will begin work to reschedule it on the existing infrastructure. This ensures that the clusters continue to function at the optimal state.

  3. Self-healing allows for greater reliability across applications.

Copyright ©2024 Educative, Inc. All rights reserved