<p>I'm playing with the Elasticsearch operator Kubernetes and created two stateful sets (see <a href="https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-orchestration.html" rel="nofollow noreferrer">https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-orchestration.html</a>):</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
  name: quickstart
spec:
  version: 7.12.1
  nodeSets:
  - name: master-nodes
    count: 3
    config:
      node.roles: [&quot;master&quot;]
    volumeClaimTemplates:
    - metadata:
        name: elasticsearch-data
      spec:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 1Gi
        storageClassName: standard
  - name: data-nodes
    count: 3
    config:
      node.roles: [&quot;data&quot;]
    volumeClaimTemplates:
    - metadata:
        name: elasticsearch-data
      spec:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 1Gi
        storageClassName: standard
</code></pre>
<p>The problem is that I cannot delete the stateful sets. After deletion, they're recreated automatically:</p>
<pre><code>my-PC:~$ kubectl get sts
NAME                         READY   AGE
quickstart-es-data-nodes     0/0     14m
quickstart-es-master-nodes   0/0     18m
my-PC:~$ kubectl delete sts quickstart-es-data-nodes --force --grace-period=0
warning: Immediate deletion does not wait for confirmation that the running resource has been terminated. The resource may continue to run on the cluster indefinitely.
statefulset.apps &quot;quickstart-es-data-nodes&quot; force deleted
my-PC:~$ kubectl get sts
NAME                         READY   AGE
quickstart-es-data-nodes     0/3     3s
quickstart-es-master-nodes   0/0     18m
</code></pre>
<p>Before deletion I already scaled down the statefulset to 0 to ensure that all pods are terminated. But after deletion, the stateful is recreated (see quickstart-es-data-nodes).</p>
<p>So, anyone having any idea how I can delete the stateful sets without being recreated?</p>

<p>it's due to the operator you are using for the Elasticsearch. Operator manage the <strong>statefulset</strong> and will update if you delete it.</p>
<blockquote>
<p>Behind the scenes, ECK translates each NodeSet specified in the
Elasticsearch resource into a StatefulSet in Kubernetes.</p>
</blockquote>
<p>if you read the documentation: <a href="https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-orchestration.html#k8s-statefulsets" rel="nofollow noreferrer">https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-orchestration.html#k8s-statefulsets</a></p>
<p><a href="https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#on-delete" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#on-delete</a></p>
