Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

Deleting ReplicaSets#

Sumit Rawal answered on June 19, 2023 Popularity 1/10 Helpfulness 1/10

Contents


More Related Answers

  • replica set mongodb
  • replicaset autoscaling deleting
  • Read replica#

  • Deleting ReplicaSets#

    0

    What would happen if we delete the ReplicaSet? As you might have guessed, both the ReplicaSet and everything it created (the Pods) would disappear with a single kubectl delete -f go-demo-2.yml command.

    However, since ReplicaSets and Pods are loosely coupled objects with matching labels, we can remove one without deleting the other.

    We can, for example, remove the ReplicaSet we created while leaving the two Pods intact.

    1

    kubectl delete -f go-demo-2.yml --cascade=orphan

    Delete Replicasets without deleting pods

    We used the --cascade=orphan argument to prevent Kubernetes from removing all the downstream objects. As a result, we got the confirmation that “replicaset go-demo-2” was “deleted”.

    Let’s confirm that it is indeed removed from the system. 

    Popularity 1/10 Helpfulness 1/10 Language whatever
    Source: Grepper
    Tags: whatever
    Link to this answer
    Share Copy Link
    Contributed on Jun 23 2023
    Sumit Rawal
    0 Answers  Avg Quality 2/10

    Closely Related Answers



    0

    What would happen if we delete the ReplicaSet? As you might have guessed, both the ReplicaSet and everything it created (the Pods) would disappear with a single kubectl delete -f go-demo-2.yml command.

    However, since ReplicaSets and Pods are loosely coupled objects with matching labels, we can remove one without deleting the other.

    We can, for example, remove the ReplicaSet we created while leaving the two Pods intact.

    1

    kubectl delete -f go-demo-2.yml --cascade=orphan

    Delete Replicasets without deleting pods

    We used the --cascade=orphan argument to prevent Kubernetes from removing all the downstream objects. As a result, we got the confirmation that “replicaset go-demo-2” was “deleted”.

    Let’s confirm that it is indeed removed from the system.

    1

    kubectl get rs

    Get the List of running Replicasets

    As expected, the output states that “no resources were found”.

    If --cascade=orphan indeed prevents Kubernetes from removing the downstream objects, the Pods should continue running in the cluster. Let’s confirm the assumption.

    1

    kubectl get pods

    Get the list of running pods

    The output is as follows.

    123

    NAME READY STATUS RESTARTS AGE

    go-demo-2-md5xp 2/2 Running 0 9m

    go-demo-2-vnmf7 2/2 Running 0 9m

    Details of running pods

    The two Pods created by the ReplicaSet are indeed still running in the cluster even though we removed the ReplicaSet.

    The Pods that are currently running in the cluster do not have any relation with the ReplicaSet we created earlier. We deleted the ReplicaSet, and the Pods are still there.

    Knowing that the ReplicaSet uses labels to decide whether the desired number of Pods is already running in the cluster, should lead us to the conclusion that if we create the same ReplicaSet again, it should reuse the two Pods that are running in the cluster. Let’s confirm that.

    Popularity 2/10 Helpfulness 1/10 Language whatever
    Source: Grepper
    Tags: whatever
    Link to this answer
    Share Copy Link
    Contributed on Jun 19 2023
    Sumit Rawal
    0 Answers  Avg Quality 2/10

    0

    What would happen if we delete the ReplicaSet? As you might have guessed, both the ReplicaSet and everything it created (the Pods) would disappear with a single kubectl delete -f go-demo-2.yml command.

    However, since ReplicaSets and Pods are loosely coupled objects with matching labels, we can remove one without deleting the other.

    We can, for example, remove the ReplicaSet we created while leaving the two Pods intact.

    1

    kubectl delete -f go-demo-2.yml --cascade=orphan

    Delete Replicasets without deleting pods

    We used the --cascade=orphan argument to prevent Kubernetes from removing all the downstream objects. As a result, we got the confirmation that “replicaset go-demo-2” was “deleted”.

    Let’s confirm that it is indeed removed from the system.

    1

    kubectl get rs

    Get the List of running Replicasets

    As expected, the output states that “no resources were found”.

    If --cascade=orphan indeed prevents Kubernetes from removing the downstream objects, the Pods should continue running in the cluster. Let’s confirm the assumption.

    1

    kubectl get pods

    Get the list of running pods

    The output is as follows.

    123

    NAME READY STATUS RESTARTS AGE

    go-demo-2-md5xp 2/2 Running 0 9m

    go-demo-2-vnmf7 2/2 Running 0 9m

    Details of running pods

    The two Pods created by the ReplicaSet are indeed still running in the cluster even though we removed the ReplicaSet.

    The Pods that are currently running in the cluster do not have any relation with the ReplicaSet we created earlier. We deleted the ReplicaSet, and the Pods are still there.

    Knowing that the ReplicaSet uses labels to decide whether the desired number of Pods is already running in the cluster, should lead us to the conclusion that if we create the same ReplicaSet again, it should reuse the two Pods that are running in the cluster. Let’s confirm that.

    Popularity 1/10 Helpfulness 1/10 Language whatever
    Source: Grepper
    Tags: whatever
    Link to this answer
    Share Copy Link
    Contributed on Jun 20 2023
    Sumit Rawal
    0 Answers  Avg Quality 2/10

    0

    Deleting ReplicaSets

    What would happen if we delete the ReplicaSet? As you might have guessed, both the ReplicaSet and everything it created (the Pods) would disappear with a single kubectl delete -f go-demo-2.yml command.

    However, since ReplicaSets and Pods are loosely coupled objects with matching labels, we can remove one without deleting the other.

    We can, for example, remove the ReplicaSet we created while leaving the two Pods intact.

    1

    kubectl delete -f go-demo-2.yml --cascade=orphan

    Delete Replicasets without deleting pods

    We used the --cascade=orphan argument to prevent Kubernetes from removing all the downstream objects. As a result, we got the confirmation that “replicaset go-demo-2” was “deleted”.

    Let’s confirm that it is indeed removed from the system.

    1

    kubectl get rs

    Get the List of running Replicasets

    As expected, the output states that “no resources were found”.

    If --cascade=orphan indeed prevents Kubernetes from removing the downstream objects, the Pods should continue running in the cluster. Let’s confirm the assumption.

    1

    kubectl get pods

    Get the list of running pods

    The output is as follows.

    123

    NAME READY STATUS RESTARTS AGE

    go-demo-2-md5xp 2/2 Running 0 9m

    go-demo-2-vnmf7 2/2 Running 0 9m

    Details of running pods

    The two Pods created by the ReplicaSet are indeed still running in the cluster even though we removed the ReplicaSet.

    The Pods that are currently running in the cluster do not have any relation with the ReplicaSet we created earlier. We deleted the ReplicaSet, and the Pods are still there.

    Knowing that the ReplicaSet uses labels to decide whether the desired number of Pods is already running in the cluster, should lead us to the conclusion that if we create the same ReplicaSet again, it should reuse the two Pods that are running in the cluster. Let’s confirm that.

    Popularity 1/10 Helpfulness 1/10 Language whatever
    Source: Grepper
    Tags: whatever
    Link to this answer
    Share Copy Link
    Contributed on Jun 23 2023
    Sumit Rawal
    0 Answers  Avg Quality 2/10

    0

    What would happen if we delete the ReplicaSet? As you might have guessed, both the ReplicaSet and everything it created (the Pods) would disappear with a single kubectl delete -f go-demo-2.yml command.

    However, since ReplicaSets and Pods are loosely coupled objects with matching labels, we can remove one without deleting the other.

    We can, for example, remove the ReplicaSet we created while leaving the two Pods intact. 

    Popularity 1/10 Helpfulness 1/10 Language whatever
    Source: Grepper
    Tags: whatever
    Link to this answer
    Share Copy Link
    Contributed on Jun 23 2023
    Sumit Rawal
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.