Search code examples
kubernetescontainersopenshiftstatefulset

Deleting Stateful Sets in Kubernetes


How to delete the Stateful Sets in Kubernetes permanently? They get re-created even after I delete them by setting --force and --grace-period=0 flags.

I know I can delete them all by removing the deployment itself. I'm interested in knowing if there is any way to preserve the deployments and delete only unwanted Stateful Sets.


Solution

  • Scaling the deployment to 0 will remove the pods, but will keep the deployment:

    kubectl scale deploy/my-deployment --replicas=0