doctl Verified current stable Not installed? Kubernetes

Doctl / Delete Kubernetes Cluster

Delete Kubernetes Cluster

Deletes a specified Kubernetes cluster and its resources.

$
Terminal
doctl k c d <cluster_name>

When To Use

When decommissioning a cluster that's no longer in use to prevent unnecessary resource charges.

Pro Tip

Use the `--wait` flag to block until deletion is confirmed, ensuring no orphaned resources remain.

Warning

Destructive operation. Confirm the target path and keep a backup before executing.

Command Builder

Tune the command before you copy it

Back to syntax
$
Generated Command
doctl k c d <cluster_name>

Terminal Output

Expected runtime feedback

Simulated preview
>
Output
$ doctl kubernetes cluster delete my-cluster

Deleting Kubernetes cluster 'my-cluster'...

ID          Name         Region       Version
------------------------------------------------
12345678    my-cluster   nyc1         1.21.5

Cluster 'my-cluster' deleted successfully.

Anatomy of Output

Understanding the result

Deleting cluster: my-cluster Progress Notification

Indicates which cluster is currently being deleted.

Deletion status: In Progress Status Update

Current status of the deletion process.

Cluster my-cluster deleted successfully Completion Confirmation

Final confirmation of successful deletion.

Troubleshooting

Common pitfalls

Error: Cluster {{cluster_name}} not found.

Solution: Verify the name is correct and exists.

Error: Cluster is in a state that cannot be deleted.

Solution: Check the cluster status; it must be in a running state.

Error: You do not have permission to delete this cluster.

Solution: Check user privileges and DigitalOcean account settings.

Command Breakdown

What each part is doing

doctl
Base Command
The executable that performs this operation. Here it runs Doctl before the shell applies any redirect operators.
k
k|kubernetes
The value supplied for k|kubernetes.
c
c|cluster
The value supplied for c|cluster.
d
d|delete
The value supplied for d|delete.
<cluster_name>
cluster name
The value supplied for cluster name.

How To Run

Execution path

  1. Step 1

    Run `doctl kubernetes cluster list` to find the cluster name.

  2. Step 2

    Execute `doctl kubernetes cluster delete <cluster_name>` to delete the cluster.

Alternative Approaches

Comparable commands in other tools

Alternative kubernetes tools for the same job.