Delete a Cluster

Learn how to delete a Kubernetes cluster on Oracle Linux Virtualization Manager.

Deleting a self-managed cluster requires that a second cluster is available to run the Kubernetes Cluster API controllers (a management cluster). This is because the final stages of cluster destruction destroys any remaining VMs, and, by extension, cluster nodes. When this is complete, no VMs are available to run the controllers. If a management cluster isn't available, an ephemeral cluster is created to service this need.

Deleting an Oracle Linux Virtualization Manager Cluster

  1. Delete the Kubernetes cluster running on Oracle Linux Virtualization Manager.

    Use the ocne cluster delete command to delete the cluster. They syntax to use is:

    ocne cluster delete 
    [{-C|--cluster-name} name]
    [{-c|--config} URI] 
    [{-P|--provider} provider]
    [{-s|--session} URI]

    For more information on the syntax options, see Oracle Cloud Native Environment: CLI.

    For example:

    ocne cluster delete --cluster-name mycluster

    or:

    ocne cluster delete --config myconfig.yaml

    The management cluster deletes the Oracle Linux Virtualization Manager workload cluster. If the cluster is self managed, an ephemeral cluster is created and the Kubernetes Cluster API resources are migrated to the ephemeral cluster.

    Tip:

    Monitor the cluster deletion process in a separate terminal session. Set the KUBECONFIG environment variable to the management cluster.

    export KUBECONFIG=$(ocne cluster show --cluster-name cluster-name)

    Replace cluster_name with the name of the management cluster. Then enter:

    kubectl get cluster -A

    The cluster object is in the deleting state. When the cluster object is no longer available, the delete is completed.

  2. Delete the management cluster.

    You might also need to delete the management cluster, depending on the settings in the environment. Use the ocne cluster delete command to delete the management cluster. For example:

    ocne cluster delete --cluster-name mycluster