Deleting a ReplicaSet and its Pods
Deleting a ReplicaSet
Replicaset can be deleted by using the following command:
kubectl delete rs <name of the replicaset>
Kubectl is a command line interface that will help you to connect to the kubernetes cluster and rs is the short name of replicaset.
Deleting The Pod
The pod can be deleted by using the following command.
kubectl delete pods –selector <key= pair>
You can delete the pod without deleting the replicaset by using the above command. If you want to update the pods then you need to delete the pod and then again redeploy it because the replicaset will not support the rolling updates of the pod.
Kubernetes – Creating a ReplicaSet
Pre-requisite: Kubernetes
A ReplicaSet is a key component of a Kubernetes application. It is a controller that ensures that a specified number of pod replicas are running at any given time. It is used to automatically replace any pods that fail, get deleted, or are terminated, ensuring the desired number of replicas are always available to serve requests. When a ReplicaSet is created, it creates the desired number of replicas of the specified pod. It then continuously monitors the status of the replicas to ensure that the desired number is always maintained. If the number of replicas exceeds the desired number, the ReplicaSet will delete excess replicas.
- Pods: A pod is the smallest deployable unit that can be created and managed. It is a logical host for one or more containers and all containers in a pod run on the same node in a cluster.
- Cluster: A cluster is a group of physical or virtual machines that are used to host containerized applications. It consists of a group of worker machines, called nodes, that run the containers, and a control plane that manages the nodes and the applications running on them.