A pod isn't self-healing. When a pod encounters failure, it won't recover on its own. This is where ReplicaSet (RS) comes into play. ReplicaSet ensures that the specified number of replica pods are always up and running in the cluster. If a pod crashes for any reason, ReplicaSet will send a request to spin up a new pod.
ReplicaSet is similar to ReplicationController (RC), which was used in older versions of Kubernetes. Unlike ReplicaSet, which uses set-based selector requirement, ReplicationController used equality-based selector requirements. It has now been completely replaced by ReplicaSet.
Let's see how ReplicaSet works:
Get DevOps with Kubernetes - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.