ReplicaSets
A ReplicaSet ensures that a certain number of pods are running at any point in time.If there are more pods running, the ReplicaSet will kill the pods.
Additionally, if any pod dies and the total number of pods is fewer than the defined number of pods, the ReplicaSet will spin up more pods.
Each pod is supposed to run a single instance of an application. If you want to scale your application horizontally, you can create multiple instances of that pod.
The pod ReplicaSet is used for scaling pods in your Kubernetes cluster.
It is usually not recommended to create pods manually but instead use multiple instances of the same application; these are then identical pods, called replicas.
Such a set of replicated Pods are created and managed by a controller, such as a Deployment.
As long as the primary conditions are met: enough CPU and memory is available in the cluster, the ReplicaSet is self-healing; it provides fault tolerance and high availibility.
It's only purpose is to ensure that the specified number of replicas of a service is running.
All pods are managed through Controllers and Services. They know about the pods that they have to manage through the in-yaml defined Labels within the pods and the selectors within the Controllers/Services. Remember the metadata field from one of the previous days — in the case of ReplicaSets, these labels are used again.
Clone the repository
enter into the root folder
cd k8s-specs
Looking at the following example
cat rs/go-demo-2.yml