<p>I created a Kubernetes cluster using ansible-playbook command below</p>

<pre><code>ansible-playbook kubectl.yaml --extra-vars "kubernetes_api_endpoint=&lt;Path to aws load balancer server&gt;"
</code></pre>

<p>Now I have deleted the cluster using command</p>

<pre><code>kubectl config delete-cluster &lt;Name of cluster&gt;
</code></pre>

<p>But still EC2 nodes are running, I tried to manually stop them but they start again automatically (expected because they are running in a cluster)</p>

<p>Is there any way by which I can detach the nodes from the cluster or delete the cluster in total?</p>

<p>Kubectl config view shows below message</p>

<blockquote>
  <p>apiVersion: v1
  clusters: []
  contexts:
  - context:
     cluster: ""
     user: ""
   name: default-context
  current-context: default-context
  kind: Config
  preferences: {}
  users:
  - name: cc3.k8s.local
    user:
     token: cc3.k8s.local</p>
</blockquote>

<p>This means there is no cluster.
I want to delete the cluster in total and start fresh.</p>

<p>I just ran into this same problem.  You need to delete the autoscaling group that spawns the worker nodes, which for some reason isn't deleted when you delete the EKS cluster.</p>

<p>Open the AWS console (console.aws.amazon.com), navigate to the EC2 dashboard, then scroll down the left pane to "Auto Scaling Groups".  Deleting the autoscaling group should stop the worker nodes from endlessly spawning.  You may also want to click on "Launch Configurations" and delete the template as well.</p>

<p>HTH!</p>
