Kubernetes 101 : Deleting a replicaSet without deleting the Pods
Once we delete the replicaSet the pods attached to it get automatically deleted.
Deleting the replicaSet without deleting the pods:
Below is a Yaml file of a replicaSet called "replica_1":
We can create the replicaSet using the below command:
The replicaSet "has" three pods replicas of a "debian" image.
Displaying the pods:
We use the below command to display our pods:
Deleting our replicaSet:
To delete our replicaSet "replica_1" without deleting the pods attached to it, we use the below command:
Remark:
The --cascade option set to "orphan" tells the command to only delete the replicaSet without deleting the pods.
Cheking the pods:
After deleting the replicaSet, we check our pods:
We see that our pods are still running.
Remark:
If we re-create our replicaSet using the "kubectl create" command, the replicaSet "replica_1" will get re-attached to the pods above.
That is the role of labels and selectors.
Comments