kubernetes cluster service is deleted but still pod is run

Vikas Mehta 0 Reputation points
2025-04-03T16:48:06.62+00:00

kubernetes cluster service is deleted but still pod is running unnesesary replicas is generating by system ,not able to delete replica permanently

Azure Kubernetes Service
Azure Kubernetes Service
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
2,448 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Markapuram Sudheer Reddy 2,050 Reputation points Microsoft External Staff Moderator
    2025-04-03T18:16:05.6133333+00:00

    Hi Vikas Mehta,

    A service in Kubernetes cluster provides a stable network endpoint for accessing those pods. Deleting a Service does not affect the lifecycle of the pod as pods are managed by controllers like Deployments or ReplicaSets. The Controllers will recreate the pods to maintain the desired number of replicas.

    Try deleting replica set, if it is running. You can try removing all the pods in a ReplicaSet without deleting the ReplicaSet ensuring no pods are running or try deleting replicaset.

    kubectl scale replicaset <replicaset-name> --replicas=0

    kubectl delete replicaset <your_replica_controller_name>

    Check if a Deployment is managing the ReplicaSet, if pods are still being recreated. To overcome this, scale down or delete the Deployment:

    kubectl scale deployment <deployment-name> --replicas=0

    kubectl delete deployment <deployment-name>

    If the information is helpful, please click on "Upvote"

    If you have any queries, please do let us know, we will help you.

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.